diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-02 18:20:22 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-02 18:20:22 +0100 |
commit | 9d6d2c0eb21b6295b2668c23f0ef386d5827a83f (patch) | |
tree | ec4bedce6f3a695aa75412f30259e0f791f46f82 /ui/window.h | |
parent | Add an InstanceVertices partition perf test (diff) | |
parent | Build ImGui as a static library (diff) | |
download | ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.tar.bz2 ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.tar.xz ilt-9d6d2c0eb21b6295b2668c23f0ef386d5827a83f.zip |
Psycho-rebased branch imgui on top of main
Diffstat (limited to 'ui/window.h')
-rw-r--r-- | ui/window.h | 29 |
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; }; |