diff options
Diffstat (limited to 'ViewController.cpp')
-rw-r--r-- | ViewController.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ViewController.cpp b/ViewController.cpp index 2ed68b5..9723dbd 100644 --- a/ViewController.cpp +++ b/ViewController.cpp @@ -5,12 +5,15 @@ ViewController::ViewController(View & v, Museum & m) : view(v), museum(m) {}; void ViewController::update() { + // set size 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(); + + // draw tiles for (unsigned y = 0; y < height; y++) { for (unsigned x = 0; x < width; x++) { Tile & tile = canvas.get_tile(x, y); @@ -23,6 +26,20 @@ void ViewController::update() { this->view.draw_rect(rect, tile.color); } } + + // draw artists + People & people = this->museum.people; + for (size_t i = 0; i < people.artists_size(); i++) { + Artist & artist = people.get_artist(i); + Rectangle rect = { + .x = static_cast<unsigned int>(artist.data.x * scale - ((float) artist_size / 2)), + .y = static_cast<unsigned int>(artist.data.y * scale - ((float) artist_size / 2)), + .width = artist_size, + .height = artist_size, + }; + this->view.draw_rect(rect, { 0, 0, 0 }); + } + this->view.draw_end(); } |