summaryrefslogtreecommitdiff
path: root/ui/window.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-06-15 15:28:53 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-06-15 15:28:53 +0100
commit02c3f1fd622bb5b4da1462c5bb507a4a541447d5 (patch)
tree8db9ad8cc755cdab17d11a97309b3b147c576964 /ui/window.h
parentAdd imgui init and shutdown to appbase and gamemainwindow (diff)
downloadilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.tar.bz2
ilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.tar.xz
ilt-02c3f1fd622bb5b4da1462c5bb507a4a541447d5.zip
First cut reshuffling app/window/gl/render bits
Diffstat (limited to 'ui/window.h')
-rw-r--r--ui/window.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/ui/window.h b/ui/window.h
index 8f2b70b..62c34de 100644
--- a/ui/window.h
+++ b/ui/window.h
@@ -1,13 +1,12 @@
#pragma once
#include "chronology.h"
-#include "collection.h"
-#include "gfx/gl/uiShader.h"
+#include "config/types.h"
#include "ptr.h"
-#include "uiComponent.h" // IWYU pragma: keep
+#include "special_members.h"
+#include "windowContent.h"
#include <SDL2/SDL.h>
#include <cstddef>
-#include <special_members.h>
#include <string>
using SDL_WindowPtr = wrapped_ptrt<SDL_Window, SDL_CreateWindow, SDL_DestroyWindow>;
@@ -22,24 +21,26 @@ public:
NO_COPY(Window);
NO_MOVE(Window);
- virtual void tick(TickDuration elapsed) = 0;
+ template<typename C, typename... P>
+ void
+ setContent(P &&... p)
+ {
+ glm::ivec2 size {};
+ SDL_GetWindowSizeInPixels(m_window, &size.x, &size.y);
+ content = std::make_unique<C>(size.x, size.y, std::forward<P>(p)...);
+ }
+
+ void tick(TickDuration elapsed);
void refresh() const;
bool handleInput(const SDL_Event & e);
- void clear(float r, float g, float b, float a) const;
void swapBuffers() const;
protected:
- virtual void render() const;
-
- struct GLInitHelper {
- GLInitHelper();
- };
+ void clear(float r, float g, float b, float a) const;
const ScreenAbsCoord size;
SDL_WindowPtr m_window;
SDL_GLContextPtr glContext;
- GLInitHelper glInithelper;
- Collection<UIComponent> uiComponents;
- UIShader uiShader;
+ WindowContent::Ptr content;
};