diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-09 21:04:57 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-09 21:04:57 +0200 |
commit | f20e49a71a7ee186057f5b79aeb58f9f22b352f4 (patch) | |
tree | 2dc11aa28c1226a2baf90b182435dbdc596a8553 /Canvas.cpp | |
parent | 76950c6100371c28f82f2e130dcfdb7d7dac97df (diff) |
parse artists.csv
Diffstat (limited to 'Canvas.cpp')
-rw-r--r-- | Canvas.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Canvas.cpp b/Canvas.cpp new file mode 100644 index 0000000..63dbe74 --- /dev/null +++ b/Canvas.cpp @@ -0,0 +1,14 @@ +#include "Canvas.h" + +Tile & Canvas::get_tile(unsigned x, unsigned y) { + return this->tiles[this->pos_to_index(x, y)]; +} + +void Canvas::set_tile(unsigned x, unsigned y, TileData t) { + this->tiles[this->pos_to_index(x, y)] = Tile(t); +} + +size_t Canvas::pos_to_index(unsigned x, unsigned y) { + return y * this->data.columns + x; +} + |