From 27a3f3365c6a46c5b85f5be676b53a758b35a73e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 10 Oct 2022 20:49:43 +0100 Subject: GameMainSelector provides world overlay and renders its target --- ui/gameMainSelector.cpp | 13 +++++++++++++ ui/gameMainSelector.h | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ui/gameMainSelector.cpp b/ui/gameMainSelector.cpp index ff9afb7..a5356ab 100644 --- a/ui/gameMainSelector.cpp +++ b/ui/gameMainSelector.cpp @@ -28,6 +28,14 @@ GameMainSelector::render(const UIShader & shader, const Position & parentPos) co } } +void +GameMainSelector::render(const Shader & shader) const +{ + if (target) { + target->render(shader); + } +} + bool GameMainSelector::handleInput(const SDL_Event & e, const Position & parentPos) { @@ -102,3 +110,8 @@ void GameMainSelector::Component::render(const UIShader &, const UIComponent::Position &) const { } + +void +GameMainSelector::Component::render(const Shader &) const +{ +} diff --git a/ui/gameMainSelector.h b/ui/gameMainSelector.h index 04f2fd7..38d8eb1 100644 --- a/ui/gameMainSelector.h +++ b/ui/gameMainSelector.h @@ -3,6 +3,7 @@ #include "SDL_events.h" #include "special_members.hpp" #include "uiComponent.h" +#include "worldOverlay.h" #include #include #include @@ -10,7 +11,7 @@ class Ray; class UIShader; class Camera; -class GameMainSelector : public UIComponent { +class GameMainSelector : public UIComponent, public WorldOverlay { public: class Component { public: @@ -20,11 +21,13 @@ public: virtual bool move(const SDL_MouseMotionEvent &, const Ray &); virtual bool handleInput(const SDL_Event &, const Position & pos); virtual void render(const UIShader & shader, const Position & pos) const; + virtual void render(const Shader &) const; }; GameMainSelector(const Camera * c, glm::vec2 size); void render(const UIShader & shader, const Position & pos) const override; + void render(const Shader & shader) const override; bool handleInput(const SDL_Event & e, const Position &) override; -- cgit v1.2.3