summaryrefslogtreecommitdiff
path: root/themes/src/winter
diff options
context:
space:
mode:
authorMatthew Kosarek <matthew@matthewkosarek.xyz>2023-09-27 16:52:17 -0400
committerMatthew Kosarek <matthew@matthewkosarek.xyz>2023-09-27 16:52:17 -0400
commit9262b5c798e1921c759addb492b592f3ccf64980 (patch)
tree47c22d423f49678c8e50b365350777cc05ed17ac /themes/src/winter
parent1da356d8a64c45c99871aca156ee9fdd3e10ec15 (diff)
Moving renderer construction out to the individual themes instead of main.cpp
Diffstat (limited to 'themes/src/winter')
-rw-r--r--themes/src/winter/WinterTheme.cpp16
-rw-r--r--themes/src/winter/WinterTheme.hpp9
2 files changed, 13 insertions, 12 deletions
diff --git a/themes/src/winter/WinterTheme.cpp b/themes/src/winter/WinterTheme.cpp
index 69e7e69..052670e 100644
--- a/themes/src/winter/WinterTheme.cpp
+++ b/themes/src/winter/WinterTheme.cpp
@@ -1,10 +1,10 @@
#include "WinterTheme.hpp"
#include "../Renderer2d.h"
-WinterTheme::WinterTheme(Renderer2d* renderer)
- : renderer{renderer}
+WinterTheme::WinterTheme(WebglContext* context)
{
- load(renderer);
+ renderer.load(context);
+ load();
}
WinterTheme::~WinterTheme()
@@ -12,10 +12,10 @@ WinterTheme::~WinterTheme()
unload();
}
-void WinterTheme::load(Renderer2d* renderer) {
- renderer->clearColor = Vector4(200, 229, 239, 255).toNormalizedColor();
+void WinterTheme::load() {
+ renderer.clearColor = Vector4(200, 229, 239, 255).toNormalizedColor();
SnowflakeLoadParameters lp;
- spr.load(lp, renderer);
+ spr.load(lp, &renderer);
}
void WinterTheme::update(f32 dtSeconds) {
@@ -23,8 +23,8 @@ void WinterTheme::update(f32 dtSeconds) {
}
void WinterTheme::render() {
- renderer->render();
- spr.render(renderer);
+ renderer.render();
+ spr.render(&renderer);
}
void WinterTheme::unload() {
diff --git a/themes/src/winter/WinterTheme.hpp b/themes/src/winter/WinterTheme.hpp
index 7e5f2ef..5ba6d94 100644
--- a/themes/src/winter/WinterTheme.hpp
+++ b/themes/src/winter/WinterTheme.hpp
@@ -4,21 +4,22 @@
#include "Snowflake.h"
#include "../types.h"
#include "../theme.h"
+#include "../Renderer2d.h"
-struct Renderer2d;
+struct WebglContext;
struct WinterTheme : public Theme {
public:
- WinterTheme(Renderer2d* renderer);
+ WinterTheme(WebglContext*);
~WinterTheme();
SnowflakeParticleRenderer spr;
- void load(Renderer2d* renderer);
+ void load();
void update(f32 dtSeconds);
void render();
void unload();
private:
- Renderer2d* renderer;
+ Renderer2d renderer;
};
#endif