diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index 2be9872b..3141939d 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -330,7 +330,7 @@ void Controller::OnInput() { case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_CLOSE: - CloseWindow(); + active_ = false; break; case SDL_WINDOWEVENT_SIZE_CHANGED: ChangeWindowSizeEvent(event); @@ -404,14 +404,14 @@ absl::Status Controller::CreateSDL_Window() { int screenWidth = displayMode.w * 0.8; int screenHeight = displayMode.h * 0.8; - window_ = std::unique_ptr( + window_ = std::unique_ptr( SDL_CreateWindow("Yet Another Zelda3 Editor", // window title SDL_WINDOWPOS_UNDEFINED, // initial x position SDL_WINDOWPOS_UNDEFINED, // initial y position screenWidth, // width, in pixels screenHeight, // height, in pixels SDL_WINDOW_RESIZABLE), - sdl_deleter()); + core::SDL_Deleter()); if (window_ == nullptr) { return absl::InternalError( absl::StrFormat("SDL_CreateWindow: %s\n", SDL_GetError())); diff --git a/src/app/core/controller.h b/src/app/core/controller.h index 3ddf3848..72fe6b64 100644 --- a/src/app/core/controller.h +++ b/src/app/core/controller.h @@ -3,14 +3,13 @@ #include +#include + #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/imconfig.h" #include "imgui/imgui.h" #include "imgui/imgui_internal.h" - -#include - #include "absl/status/status.h" #include "app/core/common.h" #include "app/core/platform/renderer.h" @@ -56,22 +55,6 @@ class Controller : public ExperimentFlags { auto window() -> SDL_Window * { return window_.get(); } private: - struct sdl_deleter { - void operator()(SDL_Window *p) const { - if (p) { - SDL_DestroyWindow(p); - } - } - void operator()(SDL_Renderer *p) const { - if (p) { - SDL_DestroyRenderer(p); - } - } - void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); } - }; - - void CloseWindow() { active_ = false; } - friend int ::main(int argc, char **argv); bool active_;