From f20e49a71a7ee186057f5b79aeb58f9f22b352f4 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 9 Oct 2024 21:04:57 +0200 Subject: parse artists.csv --- Canvas.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Canvas.cpp (limited to 'Canvas.cpp') 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; +} + -- cgit v1.2.3