aboutsummaryrefslogtreecommitdiff
path: root/Canvas.cpp
blob: 63dbe74984601b0edb61e0a6cecb7dfb928a9b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}