From 5d3ff36045bfb11af0f373d5ecee7c9b54e4c4f9 Mon Sep 17 00:00:00 2001 From: mattkae Date: Mon, 3 Apr 2023 06:35:27 -0400 Subject: Folderized all of the seasons and loading the shaders from a remote source --- themes/src/winter/Windfield.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 themes/src/winter/Windfield.cpp (limited to 'themes/src/winter/Windfield.cpp') 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 +void WindField::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 +bool WindField::addVector(i32 x, i32 y, Vector2& v) { + field[x][y] = v; + return false; +} + +template +Vector2 WindField::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(Width / positionInField.x); + i32 cellY = static_cast(Height / positionInField.y); + return field[cellX][cellY]; + } + + return Vector2(); +} -- cgit v1.2.1