From b1ed7e06089d7fd247036c082bb0968a2c2373af Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 22 Jan 2019 11:45:48 +0100 Subject: [PATCH] merged branches locally, clean up --- citizen.pde | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/citizen.pde b/citizen.pde index c6e07e0..761bd31 100644 --- a/citizen.pde +++ b/citizen.pde @@ -1,3 +1,6 @@ +import processing.net.*; + + //settings boolean b_smallerImage = false; //use a cropped, smaller version of the 1920x1080 image for faster development boolean b_loadSun = false; //load sun from web-api instead of local json file (local file is adressed to january 4th 2019. might implement a check that downloads today's information only once... @@ -6,6 +9,10 @@ boolean b_loadSun = false; //load sun from web-api instead of local json file (l boolean b_cameraFollow = true; boolean b_autoPlayAfterSelect = false; + +boolean b_controlEyeWithMouse; + + boolean b_debug = true; boolean b_drawNodes = false; @@ -21,12 +28,15 @@ int i_viewportW, i_viewportH; //} void spawnCitizen() { //happens after construction - } +Server server; +Client client; + void setup() { size(700, 600); + server = new Server(this, 5210); //blendMode(MULTIPLY); i_windowW = width; i_windowH = height; @@ -65,14 +75,16 @@ void pre() { i_uiH = height - i_uiY; } } - +String s_fromClient; +int i_mapLevelTransferC; void draw() { background(127); + clientCommunication(); pg_map.beginDraw(); pg_map.background(127); - if(b_debug) pg_map.image(img_houses, 0, 0, img_houses.width, img_houses.height); + if (b_debug) pg_map.image(img_houses, 0, 0, img_houses.width, img_houses.height); else pg_map.image(img_map, 0, 0, img_houses.width, img_houses.height); //pg_map.image(img_houses, 0, 0, img_houses.width, img_houses.height); //image(img_streets, 0, 0, img_houses.width, img_houses.height); @@ -96,14 +108,14 @@ void draw() { citizen[i].update(); if (i != i_selectedCitizen) citizen[i].display(); - if(b_debug) + if (b_debug) citizen[i].debug(); } } - - citizen[i_selectedCitizen].v2_direction.x = citizen[i_selectedCitizen].f_xPos - (float)constrain(i_mapViewToMap(mouseX, i_mapOffsetX), 0, pg_map.width); - citizen[i_selectedCitizen].v2_direction.y = citizen[i_selectedCitizen].f_yPos - (float)constrain(i_mapViewToMap(mouseY, i_mapOffsetY), 0, pg_map.height); - + + if (b_controlEyeWithMouse) { + citizen[i_selectedCitizen].turnTo(citizen[i_selectedCitizen].f_xPos-(float)constrain(i_mapViewToMap(mouseX, i_mapOffsetX), 0, pg_map.width), citizen[i_selectedCitizen].f_yPos-(float)constrain(i_mapViewToMap(mouseY, i_mapOffsetY), 0, pg_map.height), 0) ; + } citizen[i_selectedCitizen].display(); pg_map.endDraw();