-
Notifications
You must be signed in to change notification settings - Fork 0
/
OPENCHAIR.pde7168983678541441220.tmp
204 lines (185 loc) · 5.69 KB
/
OPENCHAIR.pde7168983678541441220.tmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import java.util.*;
import java.io.*;
import java.io.File;
import java.io.Serializable;
import java.util.List;
import java.io.FilenameFilter;
import java.util.regex.Pattern;
import g4p_controls.*;
import processing.serial.*;
import java.awt.*;
JSONObject json;
PFont f;
PImage logo;
PImage positionspeakingimage;
PImage loadingbar;
PImage loadingbar2;
PImage loadingbarinside;
PImage loadingbarcaucus;
class positions {
private int id;
private String position;
private int speaktime;
private int speeches;
private String chairnotes;
private boolean attendance;
private String imageurl;
private PImage positionimage;
public positions(int id, String position, int speaktime, int speeches, String chairnotes, boolean attendance, String imageurl) {
this.id = id;
this.position = position;
this.speaktime = speaktime;
this.speeches = speeches;
this.chairnotes = chairnotes;
this.attendance = attendance;
this.imageurl = imageurl;
this.positionimage = loadImage(imageurl);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public int getSpeaktime() {
return speaktime;
}
public void setSpeaktime(int speaktime) {
this.speaktime = speaktime;
}
public int getSpeeches() {
return speeches;
}
public void setSpeeches(int speeches) {
this.speeches = speeches;
}
public String getChairnotes() {
return chairnotes;
}
public void setChairnotes(String chairnotes) {
this.chairnotes = chairnotes;
}
public boolean getAttendance() {
return attendance;
}
public void setAttendance(boolean attendance) {
this.attendance = attendance;
}
public String getImageurl() {
return imageurl;
}
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}
public PImage getImage() {
return positionimage;
}
public void setImage(PImage positionimage) {
this.positionimage = positionimage;
}
}
//ARRAY MADE
ArrayList<positions> positionarray = new ArrayList<positions>();
void setup(){
File dir = new File(dataPath("") + "/positions");
File[] fileList = dir.listFiles();
println(dataPath(""));
println(Arrays.toString(fileList));
//filesList now contains all the files in sorted order
///ARRAY THAT HOLDS ALL COUNTRIES
println(Arrays.toString(fileList));
println(fileList.length);
println(fileList[0]);
String[] newFileList = new String[fileList.length];
for(int i = 0; i < fileList.length; i++) {
newFileList[i] = (fileList[i].toString().substring(dataPath("").length() + 1));
//MAKES A NEW ARRAY FROM FILELIST
}
for(int i = 0; i < fileList.length; i++) {
json = loadJSONObject(newFileList[i]);
//ADD THE CONTENTS OF EACH JSON TO ARRAY
positionarray.add(new positions(json.getInt("id"), json.getString("position"), json.getInt("speaktime"), json.getInt("speeches"), json.getString("chairnotes"), json.getBoolean("attendance"), json.getString("imageurl")));
}
json = loadJSONObject("stats.json");
totaltimespoken = json.getInt("totaltimespoken");
totalspeeches = json.getInt("totalspeeches");
//size(displayWidth, displayHeight);
//fullScreen();
size(1280, 720);
// Create the font
printArray(PFont.list());
f = createFont("MyriadPro-Regular", 315);
textFont(f);
background(255);
logo = loadImage("images/logo.png");
for(int i = 0; i < positionarray.size();i++){
positionnames.add(positionarray.get(i).getPosition());
println(positionnames.get(i));
}
for(int i = 0; i < newFileList.length; i++) {
println(positionarray.get(i).getPosition());
}
createGUI(positionarray);
customGUI();
}
ArrayList<String> positionnames = new ArrayList<String>();
int backgroundcolour = 255;
int q = 0;
int numspeak = 0;
int spokentimer = 0;
int caucustimer = 0;
int spokentimermax = 60;
int caucustimermax = 6000;
String spokentimerbar = "|";
String caucustimerbar = "|";
int totaltimespoken;
int totalspeeches;
int spokentimertimerincrementor;
int caucustimertimerincrementor;
float widthmultiplier;
void draw(){
//INTRO
if(this.q < 1){
println(q);
background(255);
textAlign(CENTER);
image(logo, (width/2 - logo.width/2/30), (height/2 - logo.height/2/30), logo.width/30, logo.height/30);
surface.setIcon(logo);
drawType(width * 0.5);
this.q++;
}
else if(this.q == 1){
delay(3000);
q++;
}
//AFTER INTRO
else{
if(timespoken.isRunning() == true){
widthmultiplier = ((width / 4) + (width / 2) * (spokentimertimerincrementor));
println(widthmultiplier);
loadingbarinside.resize(int(0.001 * widthmultiplier) + 1, loadingbar.height);
image(loadingbarinside, width / 4, 2 * height / 3);
}
//if(modcaucustime.isRunning() == true){
// widthmultiplier = ((width / 4) + (width / 2) * (caucustimertimerincrementor));
//println(widthmultiplier);
//loadingbarcaucus.resize(int(0.001 * widthmultiplier) + 1, loadingbar.height);
//image(loadingbarcaucus, width / 4, 2 * height / 3 + loadingbar.height);
//}
}
}
void drawType(float x) {
fill(0);
textSize(60);
text("OpenChair", width/2, height/2 + logo.height/2/30 + height / 12);
textSize(18);
text("Alex Shojania, 2019", width/2, height/2 + height / 5);
}
void customGUI(){
}