diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-06-15 15:28:53 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-06-15 15:28:53 +0100 |
commit | 02c3f1fd622bb5b4da1462c5bb507a4a541447d5 (patch) | |
tree | 8db9ad8cc755cdab17d11a97309b3b147c576964 /ui/gameMainWindow.cpp | |
parent | Add imgui init and shutdown to appbase and gamemainwindow (diff) | |
download | ilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.tar.bz2 ilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.tar.xz ilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.zip |
First cut reshuffling app/window/gl/render bits
Diffstat (limited to 'ui/gameMainWindow.cpp')
-rw-r--r-- | ui/gameMainWindow.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp index 8e93694..6168504 100644 --- a/ui/gameMainWindow.cpp +++ b/ui/gameMainWindow.cpp @@ -16,12 +16,6 @@ #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_) : @@ -33,22 +27,14 @@ public: } }; -GameMainWindow::GameMainWindow(size_t w, size_t h) : - Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {Window::size, 0} +GameMainWindow::GameMainWindow(size_t w, size_t h) : WindowContent {w, h}, SceneRenderer {{w, h}, 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(); -} +GameMainWindow::~GameMainWindow() { } void GameMainWindow::tick(TickDuration) @@ -60,7 +46,10 @@ void GameMainWindow::render() const { SceneRenderer::render(*this); - Window::render(); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_DEPTH_TEST); + uiComponents.apply(&UIComponent::render, uiShader, UIComponent::Position {}); } void |