diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-14 17:42:29 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-14 17:42:29 +0200 |
commit | 1e5b276394ef3fc6d91df9121a90458662a7b75c (patch) | |
tree | cca973005497b79ea00742a460d39f9ec98d9575 | |
parent | 97e2f08fcc68c83d054dada41c40eaecfc889fb1 (diff) |
make View instantiate its own controller
-rw-r--r-- | View.cpp | 2 | ||||
-rw-r--r-- | View.h | 7 | ||||
-rw-r--r-- | input/test.xml | 2 | ||||
-rw-r--r-- | main.cpp | 7 |
4 files changed, 7 insertions, 11 deletions
@@ -4,7 +4,7 @@ #include "View.h" #include "ViewController.h" -View::View(ViewController & vc) : controller(vc) { +View::View(Museum & m) : controller(m) { this->worker = new std::thread(&View::work, this); } @@ -5,12 +5,11 @@ #include "Color.h" #include "Rectangle.h" - -class ViewController; +#include "ViewController.h" class View { public: - View(ViewController & vc); + View(Museum & m); virtual ~View(); public: @@ -27,7 +26,7 @@ public: bool open = true; private: - ViewController & controller; + ViewController controller; private: unsigned int width = 0, height = 0; diff --git a/input/test.xml b/input/test.xml index 8258501..de8a973 100644 --- a/input/test.xml +++ b/input/test.xml @@ -4,7 +4,7 @@ <nodeType tag="Y" red="255" green="255" blue="0"/> <nodeType tag="B" red="0" green="0" blue="255"/> <nodeType tag="R" red="255" green="0" blue="0"/> - <nodeType tag="G" red="0" green="255" blue="0"/> + <nodeType tag="G" red="127" green="127" blue="127"/> </nodeTypes> <nodes> <Y x="0" y="0"/> @@ -31,6 +31,7 @@ static void parse(FileStrategy & file, Deserializer & deserializer, const char * int main(int argc, char** argv) { Museum museum {}; + museum.set_pause(true); Deserializer deserializer { museum }; @@ -42,11 +43,7 @@ int main(int argc, char** argv) { parse(*file, deserializer, url); } - // printf("%s", museum.canvas.to_string(true).c_str()); - // printf("%s", museum.people.to_string().c_str()); - - ViewController controller { museum }; - View view { controller }; + View view { museum }; museum.set_pause(false); |