diff options
Diffstat (limited to 'ViewController.cpp')
-rw-r--r-- | ViewController.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ViewController.cpp b/ViewController.cpp index 256be90..2ed68b5 100644 --- a/ViewController.cpp +++ b/ViewController.cpp @@ -1,12 +1,28 @@ #include "ViewController.h" #include "View.h" +#include "Museum.h" ViewController::ViewController(View & v, Museum & m) : view(v), museum(m) {}; void ViewController::update() { - this->view.set_size(100, 100); + Canvas & canvas = this->museum.canvas; + unsigned width = canvas.data.columns; + unsigned height = canvas.data.rows; + this->view.set_size(scale * width, scale * height); + this->view.draw_begin(); - this->view.draw_rect({ 10, 10, 50, 50 }, { 255, 0, 255 }); + for (unsigned y = 0; y < height; y++) { + for (unsigned x = 0; x < width; x++) { + Tile & tile = canvas.get_tile(x, y); + Rectangle rect = { + .x = x * scale, + .y = y * scale, + .width = scale - line_width, + .height = scale - line_width, + }; + this->view.draw_rect(rect, tile.color); + } + } this->view.draw_end(); } |