summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--editor/app.hpp1
-rw-r--r--editor/events.cpp5
-rw-r--r--editor/update.cpp2
-rw-r--r--floormat/main.hpp4
-rw-r--r--main/main-impl.cpp2
-rw-r--r--main/main-impl.hpp3
6 files changed, 16 insertions, 1 deletions
diff --git a/editor/app.hpp b/editor/app.hpp
index ba1133d7..9385c2a9 100644
--- a/editor/app.hpp
+++ b/editor/app.hpp
@@ -96,6 +96,7 @@ private:
void draw_editor_pane(float main_menu_height);
void draw_editor_tile_pane_atlas(tile_editor& ed, StringView name, const std::shared_ptr<tile_atlas>& atlas);
void draw_editor_scenery_pane(scenery_editor& ed);
+ void set_cursor_from_imgui();
void draw_cursor();
void init_imgui(Vector2i size);
void draw_ui();
diff --git a/editor/events.cpp b/editor/events.cpp
index 96f5c82c..cc1c0d7a 100644
--- a/editor/events.cpp
+++ b/editor/events.cpp
@@ -199,4 +199,9 @@ int app::get_key_modifiers()
return fixup_mods(M->get_mods());
}
+void app::set_cursor_from_imgui()
+{
+ _imgui.updateApplicationCursor(M->application());
+}
+
} // namespace floormat
diff --git a/editor/update.cpp b/editor/update.cpp
index 972af56e..3c8f45fe 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -167,7 +167,7 @@ void app::update(float dt)
if ([[maybe_unused]] clickable_scenery* s = find_clickable_scenery(cursor.pixel))
M->set_cursor(std::uint32_t(Cursor::Hand));
else
- M->set_cursor(std::uint32_t(Cursor::Arrow));
+ set_cursor_from_imgui();
}
} // namespace floormat
diff --git a/floormat/main.hpp b/floormat/main.hpp
index 84f25eda..8b5648a2 100644
--- a/floormat/main.hpp
+++ b/floormat/main.hpp
@@ -6,6 +6,7 @@
struct SDL_Window;
namespace Corrade::Containers { template<typename T> class ArrayView; }
+namespace Magnum::Platform { class Sdl2Application; }
namespace floormat {
@@ -35,6 +36,9 @@ struct floormat_main
fm_DECLARE_DELETED_COPY_ASSIGNMENT(floormat_main);
fm_DECLARE_DEPRECATED_MOVE_ASSIGNMENT(floormat_main);
+ virtual Platform::Sdl2Application& application() noexcept = 0;
+ virtual const Platform::Sdl2Application& application() const noexcept = 0;
+
virtual int exec() = 0;
virtual void quit(int status) = 0;
diff --git a/main/main-impl.cpp b/main/main-impl.cpp
index 01aea1ca..ae3f8cfc 100644
--- a/main/main-impl.cpp
+++ b/main/main-impl.cpp
@@ -21,6 +21,8 @@ const tile_shader& main_impl::shader() const noexcept { return _shader; }
bool main_impl::is_text_input_active() const noexcept { return const_cast<main_impl&>(*this).isTextInputActive(); }
void main_impl::start_text_input() noexcept { startTextInput(); }
void main_impl::stop_text_input() noexcept { stopTextInput(); }
+Platform::Sdl2Application& main_impl::application() noexcept { return *this; }
+const Platform::Sdl2Application& main_impl::application() const noexcept { return *this; }
int main_impl::exec()
{
diff --git a/main/main-impl.hpp b/main/main-impl.hpp
index 9178d8a6..3e60ff68 100644
--- a/main/main-impl.hpp
+++ b/main/main-impl.hpp
@@ -44,6 +44,9 @@ struct main_impl final : Platform::Sdl2Application, floormat_main
ArrayView<const clickable<anim_atlas, scenery>> clickable_scenery() const noexcept override;
ArrayView<clickable<anim_atlas, scenery>> clickable_scenery() noexcept override;
+ Platform::Sdl2Application& application() noexcept override;
+ const Platform::Sdl2Application& application() const noexcept override;
+
[[maybe_unused]] void viewportEvent(ViewportEvent& event) override;
[[maybe_unused]] void mousePressEvent(MouseEvent& event) override;
[[maybe_unused]] void mouseReleaseEvent(MouseEvent& event) override;