summaryrefslogtreecommitdiff
path: root/themes/src/autumn
diff options
context:
space:
mode:
Diffstat (limited to 'themes/src/autumn')
-rw-r--r--themes/src/autumn/AutumnTheme.cpp14
-rw-r--r--themes/src/autumn/AutumnTheme.hpp10
2 files changed, 21 insertions, 3 deletions
diff --git a/themes/src/autumn/AutumnTheme.cpp b/themes/src/autumn/AutumnTheme.cpp
index affcc00..c6431a1 100644
--- a/themes/src/autumn/AutumnTheme.cpp
+++ b/themes/src/autumn/AutumnTheme.cpp
@@ -8,6 +8,17 @@ namespace
const int NUM_HILLS = 3;
}
+AutumnTheme::AutumnTheme(Renderer2d* renderer)
+ : renderer{renderer}
+{
+ load(renderer);
+}
+
+AutumnTheme::~AutumnTheme()
+{
+ unload();
+}
+
void AutumnTheme::load(Renderer2d* renderer) {
renderer->clearColor = Vector4(252, 210, 153, 255).toNormalizedColor();
auto lr = tree.load(renderer);
@@ -45,7 +56,8 @@ void AutumnTheme::update(f32 dtSeconds) {
leafParticles.update(dtSeconds);
}
-void AutumnTheme::render(Renderer2d* renderer) {
+void AutumnTheme::render() {
+ renderer->render();
background->render();
background_hill->render();
tree.render(renderer);
diff --git a/themes/src/autumn/AutumnTheme.hpp b/themes/src/autumn/AutumnTheme.hpp
index 2d9958c..41df04c 100644
--- a/themes/src/autumn/AutumnTheme.hpp
+++ b/themes/src/autumn/AutumnTheme.hpp
@@ -4,6 +4,7 @@
#include "TreeShape.h"
#include "LeafParticleRender.h"
#include "../types.h"
+#include "../theme.h"
#include <memory>
#include <vector>
@@ -11,7 +12,10 @@ struct Renderer2d;
class RectangularGradient;
class Circleish;
-struct AutumnTheme {
+class AutumnTheme : public Theme {
+public:
+ AutumnTheme(Renderer2d* renderer);
+ ~AutumnTheme();
TreeShape tree;
LeafParticleRender leafParticles;
RectangularGradient* background;
@@ -20,8 +24,10 @@ struct AutumnTheme {
void load(Renderer2d* renderer);
void update(f32 dtSeconds);
- void render(Renderer2d* renderer);
+ void render();
void unload();
+private:
+ Renderer2d* renderer;
};
#endif