summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/app.hpp10
-rw-r--r--editor/camera.cpp4
-rw-r--r--editor/editor.cpp6
-rw-r--r--editor/editor.hpp4
-rw-r--r--editor/events.cpp4
5 files changed, 14 insertions, 14 deletions
diff --git a/editor/app.hpp b/editor/app.hpp
index 63fcd6ae..b1e8f75c 100644
--- a/editor/app.hpp
+++ b/editor/app.hpp
@@ -11,10 +11,10 @@
#include "keys.hpp"
#include <memory>
-#include <optional>
-#include <Magnum/ImGuiIntegration/Context.h>
#include <Corrade/Containers/Pointer.h>
+#include <Corrade/Containers/Optional.h>
+#include <Magnum/ImGuiIntegration/Context.h>
namespace floormat {
@@ -26,8 +26,8 @@ struct fm_settings;
struct anim_atlas;
struct cursor_state final {
- std::optional<Vector2i> pixel;
- std::optional<global_coords> tile;
+ Optional<Vector2i> pixel;
+ Optional<global_coords> tile;
bool in_imgui = false;
};
@@ -47,7 +47,7 @@ private:
int exec();
void update(float dt) override;
- void update_cursor_tile(const std::optional<Vector2i>& pixel);
+ void update_cursor_tile(const Optional<Vector2i>& pixel);
void maybe_initialize_chunk(const chunk_coords& pos, chunk& c) override;
void maybe_initialize_chunk_(const chunk_coords& pos, chunk& c);
diff --git a/editor/camera.cpp b/editor/camera.cpp
index bb69c626..35d24ef4 100644
--- a/editor/camera.cpp
+++ b/editor/camera.cpp
@@ -56,13 +56,13 @@ void app::reset_camera_offset()
update_cursor_tile(cursor.pixel);
}
-void app::update_cursor_tile(const std::optional<Vector2i>& pixel)
+void app::update_cursor_tile(const Optional<Vector2i>& pixel)
{
cursor.pixel = pixel;
if (pixel)
cursor.tile = M->pixel_to_tile(Vector2d{*pixel});
else
- cursor.tile = std::nullopt;
+ cursor.tile = NullOpt;
}
} // namespace floormat
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 67d9f344..e2690101 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -18,7 +18,7 @@ tile_editor* editor::current_tile_editor() noexcept
void editor::on_release()
{
- _last_pos = std::nullopt;
+ _last_pos = NullOpt;
}
auto editor::get_snap_value(snap_mode snap, int mods) const -> snap_mode
@@ -72,7 +72,7 @@ void editor::on_mouse_move(world& world, global_coords& pos, int mods)
}
else
on_click_(world, draw_coord, last.btn);
- _last_pos = { pos, draw_coord, snap, last.btn };
+ _last_pos = { InPlaceInit, pos, draw_coord, snap, last.btn };
}
pos = draw_coord;
}
@@ -97,7 +97,7 @@ void editor::on_click(world& world, global_coords pos, int mods, button b)
{
if (auto* mode = current_tile_editor(); mode != nullptr)
{
- _last_pos = { pos, pos, mode->check_snap(mods), b };
+ _last_pos = { InPlaceInit, pos, pos, mode->check_snap(mods), b };
on_click_(world, pos, b);
}
}
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 1c9d9bec..4f667e96 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -8,9 +8,9 @@
#include "tile-editor.hpp"
#include "scenery-editor.hpp"
-#include <optional>
#include <map>
#include <memory>
+#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/StringView.h>
namespace floormat {
@@ -58,7 +58,7 @@ private:
snap_mode snap = snap_mode::none;
button btn;
};
- std::optional<drag_pos> _last_pos;
+ Optional<drag_pos> _last_pos;
editor_mode _mode = editor_mode::floor;
bool _dirty = false;
};
diff --git a/editor/events.cpp b/editor/events.cpp
index 821c9c4d..fc55cca2 100644
--- a/editor/events.cpp
+++ b/editor/events.cpp
@@ -175,13 +175,13 @@ void app::on_viewport_event(const Math::Vector2<int>& size) noexcept
void app::on_focus_out() noexcept
{
- update_cursor_tile(std::nullopt);
+ update_cursor_tile(NullOpt);
clear_keys();
}
void app::on_mouse_leave() noexcept
{
- update_cursor_tile(std::nullopt);
+ update_cursor_tile(NullOpt);
}
void app::do_key(floormat::key k)