From 1da356d8a64c45c99871aca156ee9fdd3e10ec15 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Wed, 27 Sep 2023 08:03:04 -0400 Subject: Simplification of the Theme system with a more OO model --- themes/src/winter/WinterTheme.cpp | 14 +++++++++++++- themes/src/winter/WinterTheme.hpp | 12 +++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'themes/src/winter') 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 -- cgit v1.2.1