diff options
author | mattkae <mattkae@protonmail.com> | 2023-04-03 06:35:27 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2023-04-03 06:35:27 -0400 |
commit | 5d3ff36045bfb11af0f373d5ecee7c9b54e4c4f9 (patch) | |
tree | 1877c85fc652603312c1093ff31678ab807616b2 /themes/src/winter/Windfield.cpp | |
parent | 9e21251ea16e594c8ef416cf8a6b8ebbbb42a858 (diff) |
Folderized all of the seasons and loading the shaders from a remote source
Diffstat (limited to 'themes/src/winter/Windfield.cpp')
-rw-r--r-- | themes/src/winter/Windfield.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/themes/src/winter/Windfield.cpp b/themes/src/winter/Windfield.cpp new file mode 100644 index 0000000..88fb74b --- /dev/null +++ b/themes/src/winter/Windfield.cpp @@ -0,0 +1,28 @@ +#include "Windfield.hpp" + + +template <i32 Width, i32 Height, i32 CellDimension> +void WindField<Width, Height, CellDimension>::load(f32 cellSizePixels, i32 fieldWithCells, i32 fieldHeightCells, f32 ttl, Vector2 origin) { + this->ttl = ttl; + this->origin = origin; + this->end = this->origin + Vector2(Width * CellDimension, Height * CellDimension); +} + +template <i32 Width, i32 Height, i32 CellDimension> +bool WindField<Width, Height, CellDimension>::addVector(i32 x, i32 y, Vector2& v) { + field[x][y] = v; + return false; +} + +template <i32 Width, i32 Height, i32 CellDimension> +Vector2 WindField<Width, Height, CellDimension>::getWindFactor(Vector2& v) { + if (v.x >= origin.x && v.x <= end.x + && v.y >= origin.y && v.y <= end.y) { + Vector2 positionInField = v - this->origin; + i32 cellX = static_cast<i32>(Width / positionInField.x); + i32 cellY = static_cast<i32>(Height / positionInField.y); + return field[cellX][cellY]; + } + + return Vector2(); +} |