-
Notifications
You must be signed in to change notification settings - Fork 1
/
RadioGaGa.pde
607 lines (515 loc) · 21.4 KB
/
RadioGaGa.pde
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
import controlP5.*;
// ############################################################################################################################################################################################
// Project 4: Radio Gaga
// By Priscilla Jimenez, Hung Park and Heba Basiony
// Draft#1 11/5/2011 4:46 PM
// ############################################################################################################################################################################################
import de.umass.lastfm.*;
//Changing lololo
public PApplet papplet;
public PFont font;
public color backgroundColor = 255;
public color textColor = 0;
public color textColor2 = 255;
public color textColor1 = #9370db;
public color tabColor2 = #9370db;
public color tabColor1 = #EED2EE;
public color boldTextColor = #FFFF00;
public color titleTextColor = #BA55D3;
public color menuColor1 = #483D8B;
public color draggableContentBoxColor= #CCCCFF;
public PFont f2, fbold;
public PImage nextArrow, prevArrow;
public String titleChanged = "";
public color viewBackgroundColor = 255;
public color infoBoxBackground = #000000;
public Integrator genderic;
public int maxl, minl;
// Baby Blue, baby pink, pink, Darker blue, Dark green, green, Orange, grey,pruple
color[] barsColor = {
#C6E2FF, #FFC0CB, #EE799F, #87CEFA, #2E8B57, #BCEE68, #FFA54F, #CFCFCF, #AB82FF
};
// Committing and Changing
PImage ppl = new PImage();
public int normalFontSize = 14;
public int smallFontSize = 12 ;
public int largeFontSize = 20;
public ControlP5 controlP5;
public View mainView;
public TabView viewTabs;
public CenterView graphView;
public MenuView menuView;
public Collection<Track> topTracks;
public RelationshipsView relationshipsView;
public int mainNodeRG = 1;
// Used for Bubbles
public int circlesOnScreen;
public int maxNumOfCircles; // max number of circles (characters) that will be drawn.
public int valuesTotal = 0;
//public Ball[] balls = new Ball[0];
public SearchView searchView;
// Reading in singers and artists files
/*
<artist band name> <tab> <number of view by users> <tab> <number of male listening> <number of female listening> <tab> <ages of users listening> <tan> <region of where it was listened>
*/
public ArrayList<String> bandNames = new ArrayList<String>();
public ArrayList<String> listeners = new ArrayList<String>();
public ArrayList<String> males = new ArrayList<String>();
public ArrayList<String> females = new ArrayList<String>();
public ArrayList<String[]> ages = new ArrayList<String[]>();
//<0-9 age></t><10-19></t><20-29></t><30-39></t><40-49></t><50-59></t><60+>
public ArrayList<String[]> locations = new ArrayList<String[]>();
//<africa></t><asia></t><europe></t><australia></t><caribbean></t><middleEast></t><northAmerica></t><southAmerica>
public int maxListeners = 1;
public int minListeners = 1;
// Changing Checkboxes and radioboxes
public boolean gendersChecked = false;
public boolean regionChecked = false;
public boolean ageChecked = false;
public boolean allChecked = true;
public boolean customizeChecked = false;
public boolean maleChecked = true;
public boolean femaleChecked = true;
public boolean unknownGenderChecked = true;
public boolean genderExpand = false;
public boolean regionExpand = false;
public boolean ageExpand = false;
public boolean africaChecked = true;
public boolean asiaChecked = true;
public boolean europeChecked = true;
public boolean australiaChecked = true;
public boolean southAmericaChecked = true;
public boolean northAmericaChecked = true;
public boolean carribeanChecked = true;
public boolean middleEastChecked = true;
public boolean unknownRegionChecked = true;
public boolean nineYrsChecked = true;
public boolean nineteenYrsChecked = true;
public boolean twentyNineYrsChecked = true;
public boolean thirtyNineYrsChecked = true;
public boolean fortyNineYrsChecked = true;
public boolean fiftyNineYrsChecked = true;
public boolean sixtyOrMoreChecked = true;
public boolean unknownAgeChecked = true;
public Checkbox showMales;
public Checkbox showFemales;
public Checkbox showUnknownGender;
public ScrollMenu genderScroll;
public Checkbox showNineYrs;
public Checkbox showNineteenYrs;
public Checkbox showTwentyNineYrs;
public Checkbox showThirtyNineYrs;
public Checkbox showFortyNineYrs;
public Checkbox showFiftyNineYrs;
public Checkbox showSixtyOrMoreYrs;
public Checkbox showUnknownAge;
public ScrollMenu ageScroll;
public Checkbox showAfrica;
public Checkbox showAsia;
public Checkbox showEurope;
public Checkbox showAustralia;
public Checkbox showNorthAmerica;
public Checkbox showSouthAmerica;
public Checkbox showCarribean;
public Checkbox showMiddleEast;
public Checkbox showUnknownRegion;
public PImage checkboxChecked ;
public ScrollMenu regionScroll;
public PImage checkboxUnchecked;
public boolean draggingContent = false;
public String currentlyViewing = "";
public int currentIndex = -1;
int mainRNIndex = 0;
// public PImage checkboxChecked2 = loadImage("checkbox_checked.png");
// public PImage checkboxUnchecked2 = loadImage("checkbox_unchecked.png");
// These integrators are used for plotting
// Here're how they go:
// 0 - 9 - Used for males, Afria or 0-9 years or for overall listeners
// 10 - 19 - Used for Females, Asia, 10-19 years
// 20 - 29 Used for Undetermined Genders, Europe or 20 - 29 years
// 30 - 39 Used for N.America, 30 - 39 years
// 40 - 49 Used for S.America, 40 - 49 years
// 50 - 59 used for australia, 50 - 59 years
// 60 - 69 used for carribean, 60 or mroe years
// 70 - 79 used for middle east, unspecified age
// 80 - 89 used for unspecified region
public ArrayList<Integrator> integrators = new ArrayList<Integrator>();
public int startEntry = 0;
public int endEntry = 8;
public int maxAll= 31000000;
public int maxGender = 72000;
public int maxRegion = 80000;
public int maxAge =65000;
public void setup()
{
size(1200, 700);
f2 = loadFont("ArialMT-20.vlw");
fbold = loadFont("Arial-BoldMT-20.vlw");
checkboxChecked = loadImage("checkbox_checked.png");
checkboxUnchecked = loadImage("checkbox_unchecked.png");
textFont(f2);
papplet = this;
mainView = new View(0, 0, width, height);
genderScroll = new ScrollMenu(150, 479, 190, 5, genderExpand, 140);
regionScroll = new ScrollMenu(350,260,190,5,regionExpand,360);
ageScroll = new ScrollMenu(550,260,190,5,ageExpand,360);
// int i = 0;
// String key = "b25b959554ed76058ac220b7b2e0a026"; //this is the key used in the last.fm API examples online.
//topTracks = Artist.getTopTracks("Depeche Mode", key);
smooth();
loadData();
viewTabs = new TabView(10, 10, 500, 30);
mainView.subviews.add(viewTabs);
relationshipsView = new RelationshipsView(10, 40, 900, 550);
mainView.subviews.add(relationshipsView);
controlP5 = new ControlP5(this);
graphView = new CenterView(10, 40, 900, 500);
searchView = new SearchView(920, 10, 250, 580);
mainView.subviews.add(searchView);
nextArrow = loadImage("Next.png");
nextArrow.resize(0, 30);
prevArrow = loadImage("Previous.png");
prevArrow.resize(0, 30);
menuView = new MenuView(50, 635, 1000, 20);
gendersChecked = menuView.byGender.value;
regionChecked = menuView.byRegion.value;
for(int i = 0 ; i< 90; i++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
/*
for (Track track : topTracks) {
i++;
System.out.printf("%s (%d plays)%n", track.getName(), track.getPlaycount());
}
*/
/*
artist band name> <tab> <number of view by users> <tab> <number of male listening> <number of female listening> <tab> <ages of users listening> <tan> <region of where it was listened>
*/
showMales = new Checkbox((float)10, (float)20, 25, 25, checkboxChecked, checkboxUnchecked, "Males", true);
showFemales = new Checkbox((float)10, (float)40, 25, 25, checkboxChecked, checkboxUnchecked, "Females", true);
showUnknownGender = new Checkbox((float)10, (float)60, 25, 25, checkboxChecked, checkboxUnchecked, "Unspecified", true);
showAfrica = new Checkbox((float)10, (float)20, 25, 25, checkboxChecked, checkboxUnchecked, "Africa", true);
showAsia = new Checkbox((float)10, (float)40, 25, 25, checkboxChecked, checkboxUnchecked, "Asia", true);
showEurope = new Checkbox((float)10, (float)60, 25, 25, checkboxChecked, checkboxUnchecked, "Europe", true);
showNorthAmerica = new Checkbox((float)10, (float)80, 25, 25, checkboxChecked, checkboxUnchecked, "North America", true);
showSouthAmerica = new Checkbox((float)10, (float)100, 25, 25, checkboxChecked, checkboxUnchecked, "South America", true);
showAustralia = new Checkbox((float)10, (float)120, 25, 25, checkboxChecked, checkboxUnchecked, "Australia", true);
showCarribean = new Checkbox((float)10, (float)140, 25, 25, checkboxChecked, checkboxUnchecked, "Carribean", true);
showMiddleEast= new Checkbox((float)10, (float)160, 25, 25, checkboxChecked, checkboxUnchecked, "Middle East", true);
showUnknownRegion = new Checkbox((float)10, (float)180, 25, 25, checkboxChecked, checkboxUnchecked, "Unspecified", true);
showNineYrs = new Checkbox((float)10, (float)20, 25, 25, checkboxChecked, checkboxUnchecked, "0 - 9 years", true);
showNineteenYrs = new Checkbox((float)10, (float)40, 25, 25, checkboxChecked, checkboxUnchecked, "10 - 19 years", true);
showTwentyNineYrs = new Checkbox((float)10, (float)60, 25, 25, checkboxChecked, checkboxUnchecked, "20 - 29 years", true);
showThirtyNineYrs = new Checkbox((float)10, (float)80, 25, 25, checkboxChecked, checkboxUnchecked, "30 - 39 years", true);
showFortyNineYrs = new Checkbox((float)10, (float)100, 25, 25, checkboxChecked, checkboxUnchecked, "40 - 49 years", true);
showFiftyNineYrs = new Checkbox((float)10, (float)120, 25, 25, checkboxChecked, checkboxUnchecked, "50 - 59 years", true);
showSixtyOrMoreYrs = new Checkbox((float)10, (float)140, 25, 25, checkboxChecked, checkboxUnchecked, "60+ years", true);
showUnknownAge = new Checkbox((float)10, (float)160, 25, 25, checkboxChecked, checkboxUnchecked, "Unspecified", true);
if (!genderScroll.subviews.contains(showMales)) genderScroll.subviews.add(showMales);
if (!genderScroll.subviews.contains(showFemales)) genderScroll.subviews.add(showFemales);
// if (!genderScroll.subviews.contains(showUnknownGender)) genderScroll.subviews.add(showUnknownGender);
if (!regionScroll.subviews.contains(showAfrica))regionScroll.subviews.add(showAfrica);
if (!regionScroll.subviews.contains(showAsia))regionScroll.subviews.add(showAsia);
if (!regionScroll.subviews.contains(showEurope))regionScroll.subviews.add(showEurope);
if (!regionScroll.subviews.contains(showNorthAmerica))regionScroll.subviews.add(showNorthAmerica);
if (!regionScroll.subviews.contains(showSouthAmerica))regionScroll.subviews.add(showSouthAmerica);
if (!regionScroll.subviews.contains(showAustralia))regionScroll.subviews.add(showAustralia);
if (!regionScroll.subviews.contains(showCarribean))regionScroll.subviews.add(showCarribean);
if (!regionScroll.subviews.contains(showMiddleEast))regionScroll.subviews.add(showMiddleEast);
// if (!regionScroll.subviews.contains(showUnknownRegion))regionScroll.subviews.add(showUnknownRegion);
ageScroll.subviews.add(showNineYrs);
ageScroll.subviews.add(showNineteenYrs);
ageScroll.subviews.add(showTwentyNineYrs);
ageScroll.subviews.add(showThirtyNineYrs);
ageScroll.subviews.add(showFortyNineYrs);
ageScroll.subviews.add(showFiftyNineYrs);
ageScroll.subviews.add(showSixtyOrMoreYrs);
// ageScroll.subviews.add(showUnknownAge);
// minl = Integer.parseInt(locations.get(0)[0]);
// maxl = Integer.parseInt(locations.get(0)[0]);
/* int maxIndex = 0;
for(int j = 0; j < ages.get(0).length;j++){
minl = minl+Integer.parseInt(ages.get(0)[j]);
maxl = maxl+Integer.parseInt(ages.get(0)[j]);
}
for(int i = 1 ; i< ages.size();i++){
int l=0;
///
for(int j = 0; j < ages.get(i).length;j++){
// if(j != 4 && j != 5){
l = l+Integer.parseInt(ages.get(i)[j]);
}
//l = Integer.parseInt(locations.get(i)[0]);
if(l>maxl){
maxl = l;
maxIndex= i;
}
if(l<minl)
minl = l; //}
// }
}
System.out.println("Maximum Listeners: "+maxl+"@ Index = "+maxIndex+ "\nMinimum Listeners: "+minl);
*/
/*
minl = Integer.parseInt(males.get(0))+Integer.parseInt(females.get(0));
maxl = Integer.parseInt(males.get(0))+Integer.parseInt(females.get(0));
int maxIndex = 0;
for(int i = 1; i< males.size();i++){
int l = Integer.parseInt(males.get(i))+Integer.parseInt(females.get(i));
if(l>maxl){
maxl = l;
maxIndex= i;
}
if(l<minl)
minl = l; //}
// }
}
System.out.println("Maximum Listeners: "+maxl+"@ Index = "+maxIndex+ "\nMinimum Listeners: "+minl);
*/
for(int i = 0 ; i< 90; i++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
}
public void draw()
{
background(backgroundColor);
mainView.draw();
if (ppl != null)
image(ppl, 50, 200);
//genderic.update();
drawDraggableBox();
}
void mousePressed()
{
//System.out.println(mouseX + " , "+ mouseY);
mainView.mousePressed(mouseX, mouseY);
// tabView.mousepressed(mouseX,mouseY);
}
void mouseDragged()
{
if(viewTabs.view == 2 && graphView.lastDrag != -555){
if (mouseX < graphView.lastDrag && (graphView.lastDrag - mouseX)%10 ==0 && endEntry < bandNames.size()-1 && allChecked) {
startEntry+=1;
endEntry+=1;
graphView.subviews = new ArrayList<View>();
int x2 = 70;
int y2 = 0;
for (int j = startEntry ; j <= endEntry; j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
graphView.subviews.add(e);
x2+=90;
}
graphView.lastDrag = mouseX;
}else{
if(mouseX > graphView.lastDrag && (mouseX-graphView.lastDrag)%10 ==0 && startEntry >0 && allChecked){
startEntry-=1;
endEntry-=1;
graphView.subviews = new ArrayList<View>();
int x2 = 70;
int y2 = 0;
for (int j = startEntry ; j <= endEntry; j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
graphView.subviews.add(e);
x2+=90;
}
graphView.lastDrag = mouseX;
}
}
}
else{
mainView.mouseDragged(mouseX, mouseY);
}
}
void mouseClicked()
{
mainView.mouseClicked(mouseX, mouseY);
if (titleChanged.contains("Age")&& menuView.byAge.value ) {
menuView.byGender.value = false;
menuView.byRegion.value = false;
integrators = new ArrayList<Integrator>();
for(int j = 0 ; j< 90; j++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
int x2 = 70;
int y2 = 0;
graphView.subviews = new ArrayList<View>();
for (int j = startEntry ; j <= endEntry;j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
if (!graphView.subviews.contains(e))graphView.subviews.add(e);
x2+=90;
}
}
if (titleChanged.contains("Region")&& menuView.byRegion.value ) {
menuView.byGender.value = false;
menuView.byAge.value = false;
integrators = new ArrayList<Integrator>();
for(int j = 0 ; j< 90; j++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
int x2 = 70;
int y2 = 0;
graphView.subviews = new ArrayList<View>();
for (int j = startEntry ; j <= endEntry;j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
if (!graphView.subviews.contains(e))graphView.subviews.add(e);
x2+=90;
}
}
if (titleChanged.contains("Gender")&& menuView.byGender.value ) {
menuView.byAge.value = false;
menuView.byRegion.value = false;
integrators = new ArrayList<Integrator>();
for(int j = 0 ; j< 90; j++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
int x2 = 70;
int y2 = 0;
graphView.subviews = new ArrayList<View>();
for (int j = startEntry ; j <= endEntry;j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
if (!graphView.subviews.contains(e))graphView.subviews.add(e);
x2+=90;
}
}
if (titleChanged.contains("All")&& menuView.all.value ) {
menuView.customize.value = false;
}
if (titleChanged.contains("Chosen")&& menuView.customize.value ) {
System.out.println("Here! I'm here");
menuView.all.value = false;
}
if (titleChanged.contains("All") && menuView.all.value) {
integrators = new ArrayList<Integrator>();
for(int j = 0 ; j< 90; j++){
Integrator temp = new Integrator(graphView.h);
integrators.add(temp);
}
int x2 = 70;
int y2 = 0;
graphView.subviews = new ArrayList<View>();
for (int j = startEntry ; j <= endEntry;j++) {
Entry e = new Entry((float)x2, (float)y2, (float)50, graphView.h, j);
if (!graphView.subviews.contains(e))graphView.subviews.add(e);
x2+=90;
}
}
if(titleChanged.contains("Chosen") && menuView.customize.value){
integrators = new ArrayList<Integrator>();
graphView.subviews = new ArrayList<View>();
for(int j = 0 ; j< graphView.entryViewing.size(); j++){
}
}
// println("Clicked in new " +newcheckbox.title + " " + newcheckbox.value );
gendersChecked = menuView.byGender.value;
maleChecked = showMales.value;
femaleChecked = showFemales.value;
genderExpand = genderScroll.expanded;
// System.out.println("Gender Expand "+ genderExpand);
regionExpand = regionScroll.expanded;
// System.out.println("Region Expand "+regionExpand);
regionChecked = menuView.byRegion.value;
// System.out.println("Region Checked "+ regionChecked);
africaChecked = showAfrica.value;
asiaChecked = showAsia.value;
europeChecked = showEurope.value;
australiaChecked = showAustralia.value;
middleEastChecked = showMiddleEast.value;
northAmericaChecked = showNorthAmerica.value;
southAmericaChecked = showSouthAmerica.value;
carribeanChecked = showCarribean.value;
carribeanChecked = showCarribean.value;
unknownRegionChecked = showUnknownRegion.value;
nineYrsChecked = showNineYrs.value;
nineteenYrsChecked = showNineteenYrs.value;
twentyNineYrsChecked = showTwentyNineYrs.value;
thirtyNineYrsChecked = showThirtyNineYrs.value;
fortyNineYrsChecked = showFortyNineYrs.value;
fiftyNineYrsChecked = showFiftyNineYrs.value;
sixtyOrMoreChecked = showSixtyOrMoreYrs.value;
unknownAgeChecked = showUnknownAge.value;
gendersChecked = menuView.byGender.value;
regionChecked = menuView.byRegion.value;
ageChecked = menuView.byAge.value;
allChecked = menuView.all.value;
customizeChecked = menuView.customize.value;
carribeanChecked = showCarribean.value;
}
void keyPressed() {
//System.out.println("Here!");
//System.out.println(mainView.keypressed());
mainView.keypressed();
}
void drawDraggableBox() {
if (searchView.draggedIndex != -1) {
rectMode(CORNERS);
fill(tabColor2, 100);
strokeWeight(1);
rect(mouseX-10, mouseY-10, mouseX+203, mouseY+15);
fill(255);
textSize(12);
textAlign(CENTER);
String t = searchView.dragged;
textFont(fbold);
if (t.length()>25)
t = t.substring(0, 26);
text(t, mouseX+100, mouseY+10);
textFont(f2);
textSize(20);
}
}
void mouseReleased() {
println("release");
if (draggingContent && viewTabs.view == 1) {
if (mouseX >= 10 && mouseX <= 10 + 900 && mouseY >= 40 && mouseY <= 40 + 600) { // Inside the rectangule view.
if (searchView.draggedIndex != -1) {
println("entro");
currentlyViewing = searchView.dragged;
//System.out.println("Currently Viewing "+ currentlyViewing);
currentIndex = searchView.draggedIndex;
searchView.draggedIndex = -1;
searchView.dragged = "";
}
}
searchView.draggedIndex = -1;
searchView.dragged = "";
}else{
if(draggingContent &&viewTabs.view == 2){
if(customizeChecked){
graphView.entryViewing.add(searchView.dragged);
//System.out.println("Currently Viewing "+ currentlyViewing);
graphView.entryIndex.add(""+searchView.draggedIndex);
searchView.draggedIndex = -1;
searchView.dragged = "";
}
else{
graphView. justSearched = searchView.draggedIndex;
searchView.draggedIndex = -1;
searchView.dragged = "";
}
}else{
if(viewTabs.view == 2) graphView.lastDrag = -555;
}
}
}
void roundrect(int x, int y, int w, int h, int r, color c) {
rectMode(CORNER);
noFill();
stroke(c);
int ax, ay, hr;
ax=x+w-1;
ay=y+h-1;
hr = r/2;
arc(x+r/2, y+r/2, r, r, radians(180.0), radians(270.0));
arc(ax+r/2, y+r/2, r, r, radians(270.0), radians(360.0));
arc(x+r/2, ay+r/2, r, r, radians(90.0), radians(180.0));
arc(ax+r/2, ay+r/2, r, r, radians(0.0), radians(90.0));
line(x+1+r/2, y-hr+r/2, w-2+r/2, y-hr+r/2);
line(x, y+r/2, x, h+r/2);
line(x+1+r/2, h+hr-1+r/2, w-2+r/2, h+hr-1+r/2);
line(w+hr-1+r/2, y+r/2, w+hr-1+r/2, h+r/2);
}