diff options
| -rw-r--r-- | editor/app.cpp | 13 | ||||
| -rw-r--r-- | editor/app.hpp | 13 | ||||
| -rw-r--r-- | editor/imgui.cpp | 1 | ||||
| -rw-r--r-- | main/floormat-main-impl.cpp | 8 |
4 files changed, 21 insertions, 14 deletions
diff --git a/editor/app.cpp b/editor/app.cpp index 6f8cbed8..80f7600c 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -8,7 +8,7 @@ namespace floormat { app::app() : - M{ floormat_main::create(*this, {})}, + M{floormat_main::create(*this, {})}, _floor1{loader.tile_atlas("floor-tiles", {44, 4})}, _floor2{loader.tile_atlas("metal1", {2, 2})}, _wall1{loader.tile_atlas("wood2", {1, 1})}, @@ -18,7 +18,6 @@ app::app() : app::~app() { - loader_::destroy(); } int app::exec() @@ -84,8 +83,14 @@ int app::run_from_argv(const int argc, const char* const* const argv) } } } - app application; - return application.exec(); + + int ret; + { + app application; + ret = application.exec(); + } + loader_::destroy(); + return ret; } #ifdef _MSC_VER diff --git a/editor/app.hpp b/editor/app.hpp index e4f26cf0..b43d0e12 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -74,8 +74,12 @@ private: void do_camera(float dt); void reset_camera_offset(); void recalc_cursor_tile(); - void init_imgui(Vector2i size); + void draw_cursor_tile(); + void draw_wireframe_quad(global_coords pt); + void draw_wireframe_box(global_coords pt); + + void init_imgui(Vector2i size); void draw_ui(); float draw_main_menu(); void draw_fps(); @@ -84,14 +88,9 @@ private: void draw_editor_pane(tile_editor& type, float main_menu_height); - void draw_cursor_tile(); - - void draw_wireframe_quad(global_coords pt); - void draw_wireframe_box(global_coords pt); - Containers::Pointer<floormat_main> M; - std::shared_ptr<tile_atlas> _floor1, _floor2, _wall1, _wall2; ImGuiIntegration::Context _imgui{NoCreate}; + std::shared_ptr<tile_atlas> _floor1, _floor2, _wall1, _wall2; wireframe_mesh<wireframe::quad> _wireframe_quad; wireframe_mesh<wireframe::box> _wireframe_box; editor _editor; diff --git a/editor/imgui.cpp b/editor/imgui.cpp index d94146b7..b627d34f 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -2,7 +2,6 @@ #include "main/floormat-main.hpp" #include <Magnum/GL/Renderer.h> #include "imgui-raii.hpp" -#include <Magnum/ImGuiIntegration/Context.h> namespace floormat { diff --git a/main/floormat-main-impl.cpp b/main/floormat-main-impl.cpp index 219b131d..3cec55ac 100644 --- a/main/floormat-main-impl.cpp +++ b/main/floormat-main-impl.cpp @@ -103,7 +103,6 @@ main_impl::main_impl(floormat_app& app, fm_settings&& s) noexcept : } set_fp_mask(); fm_assert(framebufferSize() == windowSize()); - recalc_viewport(windowSize()); timeline.start(); } @@ -202,7 +201,6 @@ void main_impl::drawEvent() } void main_impl::quit(int status) { Platform::Sdl2Application::exit(status); } -int main_impl::exec() { return Sdl2Application::exec(); } struct world& main_impl::world() noexcept { return _world; } SDL_Window* main_impl::window() noexcept { return Sdl2Application::window(); } fm_settings& main_impl::settings() noexcept { return s; } @@ -214,6 +212,12 @@ bool main_impl::is_text_input_active() const noexcept { return const_cast<main_i void main_impl::start_text_input() noexcept { startTextInput(); } void main_impl::stop_text_input() noexcept { stopTextInput(); } +int main_impl::exec() +{ + recalc_viewport(windowSize()); + return Sdl2Application::exec(); +} + floormat_main* floormat_main::create(floormat_app& app, fm_settings&& options) { auto* ret = new main_impl(app, std::move(options)); |
