diff options
author | Matthew Kosarek <matthew@matthewkosarek.xyz> | 2023-09-27 16:52:17 -0400 |
---|---|---|
committer | Matthew Kosarek <matthew@matthewkosarek.xyz> | 2023-09-27 16:52:17 -0400 |
commit | 9262b5c798e1921c759addb492b592f3ccf64980 (patch) | |
tree | 47c22d423f49678c8e50b365350777cc05ed17ac /themes/src/summer | |
parent | 1da356d8a64c45c99871aca156ee9fdd3e10ec15 (diff) |
Moving renderer construction out to the individual themes instead of main.cpp
Diffstat (limited to 'themes/src/summer')
-rw-r--r-- | themes/src/summer/SummerTheme.cpp | 20 | ||||
-rw-r--r-- | themes/src/summer/SummerTheme.h | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/themes/src/summer/SummerTheme.cpp b/themes/src/summer/SummerTheme.cpp index 522b44c..1f76b56 100644 --- a/themes/src/summer/SummerTheme.cpp +++ b/themes/src/summer/SummerTheme.cpp @@ -6,10 +6,10 @@ #include "../shaders/sun_vert.h" #include <vector> -SummerTheme::SummerTheme(Renderer2d* renderer, WebglContext* context) - : renderer{renderer} +SummerTheme::SummerTheme(WebglContext* context) { - load(renderer, context); + renderer.load(context); + load(context); } SummerTheme::~SummerTheme() @@ -17,12 +17,12 @@ 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(); +void SummerTheme::load(WebglContext* context) { + renderer.load(context, shader_sun_vert, shader_sun_frag); + renderer.clearColor = Vector4(0, 181, 286, 255.f).toNormalizedColor(); sun.sectors = 180; - sun.radius = renderer->context->width / 4.f; - sun.load(renderer); + sun.radius = renderer.context->width / 4.f; + sun.load(&renderer); } void SummerTheme::update(f32 dtSeconds) { @@ -30,8 +30,8 @@ void SummerTheme::update(f32 dtSeconds) { } void SummerTheme::render() { - renderer->render(); - sun.render(renderer); + renderer.render(); + sun.render(&renderer); } void SummerTheme::unload() { diff --git a/themes/src/summer/SummerTheme.h b/themes/src/summer/SummerTheme.h index 030f20a..2ce6b7f 100644 --- a/themes/src/summer/SummerTheme.h +++ b/themes/src/summer/SummerTheme.h @@ -17,13 +17,13 @@ struct Sun { class SummerTheme : public Theme { public: - SummerTheme(Renderer2d*, WebglContext*); + SummerTheme(WebglContext*); ~SummerTheme(); Sun sun; - void load(Renderer2d*, WebglContext*); + void load(WebglContext*); void update(f32 dtSeconds); void render(); void unload(); private: - Renderer2d* renderer; + Renderer2d renderer; }; |