summaryrefslogtreecommitdiff
path: root/ui/gameMainWindow.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-02 20:28:24 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-02 20:28:24 +0000
commit4bf6b8dad9923d6f3687e8ced72a4eda6a56220d (patch)
treea3110d4f7dafae89ace66c5812a77330da53160a /ui/gameMainWindow.cpp
parentReplace include guard macros with pragma once (diff)
downloadilt-4bf6b8dad9923d6f3687e8ced72a4eda6a56220d.tar.bz2
ilt-4bf6b8dad9923d6f3687e8ced72a4eda6a56220d.tar.xz
ilt-4bf6b8dad9923d6f3687e8ced72a4eda6a56220d.zip
No need to pass GameState around, it has a global pointer
Diffstat (limited to 'ui/gameMainWindow.cpp')
-rw-r--r--ui/gameMainWindow.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index 41d55da..b904388 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -33,10 +33,7 @@ public:
class GameMainSelector : public UIComponent {
public:
- GameMainSelector(const Camera * c, glm::vec2 size, const GameState * gs) :
- UIComponent {{{}, size}}, camera {c}, gameState {gs}
- {
- }
+ GameMainSelector(const Camera * c, glm::vec2 size) : UIComponent {{{}, size}}, camera {c} { }
void
render(const UIShader &, const Position &) const override
@@ -63,13 +60,12 @@ public:
private:
const Camera * camera;
- const GameState * gameState;
};
-GameMainWindow::GameMainWindow(size_t w, size_t h, const GameState * gameState) :
+GameMainWindow::GameMainWindow(size_t w, size_t h) :
Window {w, h, "I Like Trains"}, camera {{-1250.0F, -1250.0F, 35.0F}, quarter_pi, rdiv(w, h), 0.1F, 10000.0F}
{
- uiComponents.create<GameMainSelector>(&camera, glm::vec2 {w, h}, gameState);
+ uiComponents.create<GameMainSelector>(&camera, glm::vec2 {w, h});
uiComponents.create<GameMainToolbar>();
uiComponents.create<ManualCameraController>(glm::vec2 {-1150, -1150});
@@ -86,9 +82,9 @@ GameMainWindow::tick(TickDuration)
}
void
-GameMainWindow::render(const GameState * gameState) const
+GameMainWindow::render() const
{
glEnable(GL_DEPTH_TEST);
gameState->world.apply<Renderable>(&Renderable::render, shader);
- Window::render(gameState);
+ Window::render();
}