From 9262b5c798e1921c759addb492b592f3ccf64980 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Wed, 27 Sep 2023 16:52:17 -0400 Subject: Moving renderer construction out to the individual themes instead of main.cpp --- themes/src/summer/SummerTheme.cpp | 20 ++++++++++---------- themes/src/summer/SummerTheme.h | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'themes/src/summer') 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 -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; }; -- cgit v1.2.1