aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-14 17:42:29 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-14 17:42:29 +0200
commit1e5b276394ef3fc6d91df9121a90458662a7b75c (patch)
treecca973005497b79ea00742a460d39f9ec98d9575
parent97e2f08fcc68c83d054dada41c40eaecfc889fb1 (diff)
make View instantiate its own controller
-rw-r--r--View.cpp2
-rw-r--r--View.h7
-rw-r--r--input/test.xml2
-rw-r--r--main.cpp7
4 files changed, 7 insertions, 11 deletions
diff --git a/View.cpp b/View.cpp
index 8ca7d94..c269643 100644
--- a/View.cpp
+++ b/View.cpp
@@ -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);
}
diff --git a/View.h b/View.h
index 58dc33d..ef9e937 100644
--- a/View.h
+++ b/View.h
@@ -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"/>
diff --git a/main.cpp b/main.cpp
index 693a5d2..d824e5a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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);