Added sunrise / sunset to debug

This commit is contained in:
2019-01-16 17:39:32 +01:00
parent 8be26473ea
commit 17d68f52bf
4 changed files with 16 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ void initCitizen() {
//namen: ethuriel, nathaniel, loriel, samuel, aluriel, aleriel, thaliel, suriel, kaliel,
//int[][] claireArray = { { 00, 2 }, { 1, 3} };
citizen[0] = new Citizen(59, "Test", 0, 26);
citizen[0] = new Citizen(800, "Test", 0,27);
citizen[1] = new Citizen(121, "Matze", 1, 28);
citizen[2] = new Citizen(18, "Freddy", 1, 28);
citizen[3] = new Citizen(59, "Korbi", 1, 28);

View File

@@ -1,5 +1,5 @@
//import java.util.Date;
//import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
//Date date = new Date();
//SimpleDateFormat ft;
//Calendar c = Calendar.getInstance();

4
UI.pde
View File

@@ -47,8 +47,8 @@ void drawUI() {
"Movement speed: " + round(citizen[i_selectedCitizen].f_movementSpeed*100),
"Random Run: " + citizen[i_selectedCitizen].b_randomRun,
" ",
"Global",
" ",
"Sunrise: " + S_sunrise,
"Sunset: " + S_sunset,
"Autoplay: " + b_autoPlayAfterSelect,
"Locked Camera: " + b_cameraFollow,
//"Velocity: ",

View File

@@ -1,6 +1,9 @@
PVector v2_coordinates = new PVector(48.799337, 9.794482); //badmauer; x: latitude, y: longitude
boolean b_isRaining;
String S_sunrise;
String S_sunset;
Date d_sunrise;
void initWeather(){
@@ -10,7 +13,14 @@ void initWeather(){
JSONObject sun;
if(b_loadSun) sun = loadJSONObject("https://api.sunrise-sunset.org/json?lat=" + v2_coordinates.x + " &lng=" + v2_coordinates.y);
else sun = loadJSONObject(dataPath("weather/today.json"));
println(sun);
//println(sun);
if (sun == null) {
//println("JSONObject could not be parsed");
} else {
JSONObject results = sun.getJSONObject("results");
S_sunrise = results.getString("sunrise");
S_sunset = results.getString("sunset");
}
}