diff options
author | Matthew Kosarek <matthew@matthewkosarek.xyz> | 2023-09-24 17:14:48 -0400 |
---|---|---|
committer | Matthew Kosarek <matthew@matthewkosarek.xyz> | 2023-09-24 17:14:48 -0400 |
commit | 2dca902c183ece31bc0853e1e8b93d09359515e4 (patch) | |
tree | 2478c63c0aaae3c3ad608334372a9d7a91d9088d /themes/src/autumn | |
parent | c8c6d9f13b5cae6f93f1e1615bfa484e3fa9b110 (diff) |
Rectangular gradient for the background in AutumnTheme
Diffstat (limited to 'themes/src/autumn')
-rw-r--r-- | themes/src/autumn/AutumnTheme.cpp | 12 | ||||
-rw-r--r-- | themes/src/autumn/AutumnTheme.hpp | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/themes/src/autumn/AutumnTheme.cpp b/themes/src/autumn/AutumnTheme.cpp index 6e6fe2b..754a841 100644 --- a/themes/src/autumn/AutumnTheme.cpp +++ b/themes/src/autumn/AutumnTheme.cpp @@ -1,10 +1,18 @@ #include "AutumnTheme.hpp" #include "../Renderer2d.h" +#include "../shapes_2d.h" +#include <memory> void AutumnTheme::load(Renderer2d* renderer) { renderer->clearColor = Vector4(252, 210, 153, 255).toNormalizedColor(); auto lr = tree.load(renderer); leafParticles.load(renderer, &lr); + background = new RectangularGradient(*renderer, + Vector4{135, 206, 235, 255}.toNormalizedColor(), + Vector4(252, 210, 153, 255).toNormalizedColor(), + renderer->get_width(), + renderer->get_height(), + {0, 0}); } void AutumnTheme::update(f32 dtSeconds) { @@ -13,6 +21,7 @@ void AutumnTheme::update(f32 dtSeconds) { } void AutumnTheme::render(Renderer2d* renderer) { + background->render(); tree.render(renderer); leafParticles.render(renderer); } @@ -20,4 +29,5 @@ void AutumnTheme::render(Renderer2d* renderer) { void AutumnTheme::unload() { tree.unload(); leafParticles.unload(); -}
\ No newline at end of file + delete background; +} diff --git a/themes/src/autumn/AutumnTheme.hpp b/themes/src/autumn/AutumnTheme.hpp index 18da959..7c1f4f2 100644 --- a/themes/src/autumn/AutumnTheme.hpp +++ b/themes/src/autumn/AutumnTheme.hpp @@ -4,12 +4,15 @@ #include "TreeShape.h" #include "LeafParticleRender.h" #include "../types.h" +#include <memory> struct Renderer2d; +class RectangularGradient; struct AutumnTheme { TreeShape tree; LeafParticleRender leafParticles; + RectangularGradient* background; void load(Renderer2d* renderer); void update(f32 dtSeconds); @@ -17,4 +20,4 @@ struct AutumnTheme { void unload(); }; -#endif
\ No newline at end of file +#endif |