diff options
Diffstat (limited to 'themes/src/summer')
-rw-r--r-- | themes/src/summer/SummerTheme.cpp | 14 | ||||
-rw-r--r-- | themes/src/summer/SummerTheme.h | 10 |
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; }; |