#include "ViewController.h" #include "View.h" #include "Museum.h" ViewController::ViewController(View & v, Museum & m) : view(v), museum(m) {}; void ViewController::update() { 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(); 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(); }