summaryrefslogtreecommitdiff
path: root/themes/src/summer
diff options
context:
space:
mode:
authorMatthew Kosarek <matthew@matthewkosarek.xyz>2023-09-27 08:03:04 -0400
committerMatthew Kosarek <matthew@matthewkosarek.xyz>2023-09-27 08:03:04 -0400
commit1da356d8a64c45c99871aca156ee9fdd3e10ec15 (patch)
tree00438481bc972c9606995af794be09189833510a /themes/src/summer
parentec0b1d450a0f6219b3b0d352cd6625ae05f62618 (diff)
Simplification of the Theme system with a more OO model
Diffstat (limited to 'themes/src/summer')
-rw-r--r--themes/src/summer/SummerTheme.cpp14
-rw-r--r--themes/src/summer/SummerTheme.h10
2 files changed, 21 insertions, 3 deletions
diff --git a/themes/src/summer/SummerTheme.cpp b/themes/src/summer/SummerTheme.cpp
index 6106c89..522b44c 100644
--- a/themes/src/summer/SummerTheme.cpp
+++ b/themes/src/summer/SummerTheme.cpp
@@ -6,6 +6,17 @@
#include "../shaders/sun_vert.h"
#include <vector>
+SummerTheme::SummerTheme(Renderer2d* renderer, WebglContext* context)
+ : renderer{renderer}
+{
+ load(renderer, context);
+}
+
+SummerTheme::~SummerTheme()
+{
+ unload();
+}
+
void SummerTheme::load(Renderer2d* renderer, WebglContext* context) {
renderer->load(context, shader_sun_vert, shader_sun_frag);
renderer->clearColor = Vector4(0, 181, 286, 255.f).toNormalizedColor();
@@ -18,7 +29,8 @@ void SummerTheme::update(f32 dtSeconds) {
sun.update(dtSeconds);
}
-void SummerTheme::render(Renderer2d* renderer) {
+void SummerTheme::render() {
+ renderer->render();
sun.render(renderer);
}
diff --git a/themes/src/summer/SummerTheme.h b/themes/src/summer/SummerTheme.h
index dad4ac9..030f20a 100644
--- a/themes/src/summer/SummerTheme.h
+++ b/themes/src/summer/SummerTheme.h
@@ -1,6 +1,7 @@
#pragma once
#include "../types.h"
#include "../Renderer2d.h"
+#include "../theme.h"
#include <vector>
struct Sun {
@@ -14,10 +15,15 @@ struct Sun {
void unload();
};
-struct SummerTheme {
+class SummerTheme : public Theme {
+public:
+ SummerTheme(Renderer2d*, WebglContext*);
+ ~SummerTheme();
Sun sun;
void load(Renderer2d*, WebglContext*);
void update(f32 dtSeconds);
- void render(Renderer2d* renderer);
+ void render();
void unload();
+private:
+ Renderer2d* renderer;
};