summaryrefslogtreecommitdiff
path: root/themes/src/winter
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/winter
parentec0b1d450a0f6219b3b0d352cd6625ae05f62618 (diff)
Simplification of the Theme system with a more OO model
Diffstat (limited to 'themes/src/winter')
-rw-r--r--themes/src/winter/WinterTheme.cpp14
-rw-r--r--themes/src/winter/WinterTheme.hpp12
2 files changed, 22 insertions, 4 deletions
diff --git a/themes/src/winter/WinterTheme.cpp b/themes/src/winter/WinterTheme.cpp
index 2686988..69e7e69 100644
--- a/themes/src/winter/WinterTheme.cpp
+++ b/themes/src/winter/WinterTheme.cpp
@@ -1,6 +1,17 @@
#include "WinterTheme.hpp"
#include "../Renderer2d.h"
+WinterTheme::WinterTheme(Renderer2d* renderer)
+ : renderer{renderer}
+{
+ load(renderer);
+}
+
+WinterTheme::~WinterTheme()
+{
+ unload();
+}
+
void WinterTheme::load(Renderer2d* renderer) {
renderer->clearColor = Vector4(200, 229, 239, 255).toNormalizedColor();
SnowflakeLoadParameters lp;
@@ -11,7 +22,8 @@ void WinterTheme::update(f32 dtSeconds) {
spr.update(dtSeconds);
}
-void WinterTheme::render(Renderer2d* renderer) {
+void WinterTheme::render() {
+ renderer->render();
spr.render(renderer);
}
diff --git a/themes/src/winter/WinterTheme.hpp b/themes/src/winter/WinterTheme.hpp
index 5b8cc95..7e5f2ef 100644
--- a/themes/src/winter/WinterTheme.hpp
+++ b/themes/src/winter/WinterTheme.hpp
@@ -3,16 +3,22 @@
#include "Snowflake.h"
#include "../types.h"
+#include "../theme.h"
struct Renderer2d;
-struct WinterTheme {
+struct WinterTheme : public Theme {
+public:
+ WinterTheme(Renderer2d* renderer);
+ ~WinterTheme();
SnowflakeParticleRenderer spr;
void load(Renderer2d* renderer);
void update(f32 dtSeconds);
- void render(Renderer2d* renderer);
+ void render();
void unload();
+private:
+ Renderer2d* renderer;
};
-#endif \ No newline at end of file
+#endif