diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-06-05 02:21:00 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-06-05 02:21:00 +0100 |
commit | e4ed331cea817e55956200c9c116f8d11b54c86b (patch) | |
tree | ff152032ea715d1dbac39904c154baae6e9202d1 /ui/gameMainWindow.cpp | |
parent | Build and link imgui with sdl2 and opengl2 backends (diff) | |
download | ilt-e4ed331cea817e55956200c9c116f8d11b54c86b.tar.bz2 ilt-e4ed331cea817e55956200c9c116f8d11b54c86b.tar.xz ilt-e4ed331cea817e55956200c9c116f8d11b54c86b.zip |
Add imgui init and shutdown to appbase and gamemainwindow
Diffstat (limited to 'ui/gameMainWindow.cpp')
-rw-r--r-- | ui/gameMainWindow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp index ccbcdba..8e93694 100644 --- a/ui/gameMainWindow.cpp +++ b/ui/gameMainWindow.cpp @@ -16,6 +16,12 @@ #include <glm/glm.hpp> #include <memory> +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" +#include "backends/imgui_impl_opengl3.h" +#include "backends/imgui_impl_sdl2.h" +#pragma GCC diagnostic pop + class GameMainToolbar : Mode<decltype(GameMainSelector::target)>, public Toolbar { public: explicit GameMainToolbar(GameMainSelector * gms_) : @@ -30,11 +36,20 @@ public: GameMainWindow::GameMainWindow(size_t w, size_t h) : Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {Window::size, 0} { + ImGui_ImplSDL2_InitForOpenGL(m_window, glContext.get()); + ImGui_ImplOpenGL3_Init(); + uiComponents.create<ManualCameraController>(glm::vec2 {310'727'624, 494'018'810}); auto gms = uiComponents.create<GameMainSelector>(&camera, ScreenAbsCoord {w, h}); uiComponents.create<GameMainToolbar>(gms.get()); } +GameMainWindow::~GameMainWindow() +{ + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplSDL2_Shutdown(); +} + void GameMainWindow::tick(TickDuration) { |