aboutsummaryrefslogtreecommitdiff
path: root/Deserializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Deserializer.cpp')
-rw-r--r--Deserializer.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/Deserializer.cpp b/Deserializer.cpp
index 48c4da9..03e58b8 100644
--- a/Deserializer.cpp
+++ b/Deserializer.cpp
@@ -10,7 +10,6 @@ Deserializer::~Deserializer() {
}
void Deserializer::finalize() {
- // TODO: fill empty squares in canvas with white ones
// TODO: remove artists outside the canvas
}
@@ -22,27 +21,30 @@ Museum & Deserializer::get_target() {
}
void Deserializer::add_artist(ArtistData data) {
+ printf("add artist(%1.2f, %1.2f)...\n", data.x, data.y);
+
Museum & museum = this->get_target();
// museum.people.add_artist(data);
- printf("add artist(%1.2f, %1.2f)...\n", data.x, data.y);
}
void Deserializer::set_canvas(CanvasData data) {
- Museum & museum = this->get_target();
- // museum.canvas.data = data;
printf("set canvas(%dx%d)...\n", data.rows, data.columns);
+
+ Museum & museum = this->get_target();
+ museum.canvas.data = data;
+ museum.canvas.update();
}
void Deserializer::add_tile(unsigned int x, unsigned int y, TileData data) {
+ printf("add tile(%d,%d) data(%c)...\n", x, y, data.type);
+
Museum & museum = this->get_target();
- // museum.canvas.set_tile(x, y, data);
- printf("add tile(%d,%d) data(%s)...\n", x, y, data.type.c_str());
+ museum.canvas.set_tile(x, y, data);
}
-void Deserializer::add_type(std::string type, Color color, unsigned int weight) {
- if (type.length() == 0) return;
-
- printf("add type(%s) color(#%02x%02x%02x) weight(%d)...\n", type.c_str(),
- color.red, color.green, color.blue, weight);
+void Deserializer::add_type(char type, Color color, unsigned int weight) {
+ if (type == '\0') return;
+ printf("add type(%c) color(#%02x%02x%02x) weight(%d)...\n", type, color.red,
+ color.green, color.blue, weight);
}