@@ -8,16 +8,21 @@ class ConnectionLight {
88 int badColor = color (255 , 255 , 0 );
99 int noColor = color (255 , 0 , 0 );
1010 Textlabel label;
11+ Textlabel packetsRecievedLabel;
1112
1213 ConnectionLight (int _x , int _y , int _diameter ) {
1314 x = _x;
1415 y = _y;
1516 diameter = _diameter;
1617
1718 // Set up the text label
18- label = new Textlabel (controlP5, " CONNECTION QUALITY" , 32 , 6 , 60 , 30 );
19+ label = new Textlabel (controlP5, " CONNECTION QUALITY" , 32 , 11 , 200 , 30 );
1920 label. setMultiline(true );
2021 label. setColorValue(color (0 ));
22+
23+ packetsRecievedLabel = new Textlabel (controlP5, " PACKETS RECEIVED: 0" , 5 , 35 , 200 , 30 );
24+ packetsRecievedLabel. setMultiline(false );
25+ packetsRecievedLabel. setColorValue(color (0 ));
2126 }
2227
2328 void update () {
@@ -32,6 +37,9 @@ class ConnectionLight {
3237 if (latestConnectionValue == 200 ) currentColor = noColor;
3338 if (latestConnectionValue < 200 ) currentColor = badColor;
3439 if (latestConnectionValue == 00 ) currentColor = goodColor;
40+
41+ packetsRecievedLabel. setText(" PACKETS RECIEVED: " + packetCount);
42+
3543 }
3644
3745 void draw () {
@@ -40,14 +48,15 @@ class ConnectionLight {
4048
4149 noStroke ();
4250 fill (255 , 150 );
43- rect (0 , 0 , 95 , 28 );
51+ rect (0 , 0 , 132 , 50 );
4452
4553 noStroke ();
4654 fill (currentColor);
4755 ellipseMode (CORNER );
4856 ellipse (5 , 4 , diameter, diameter);
4957
50- label. draw();
58+ label. draw();
59+ packetsRecievedLabel. draw();
5160 popMatrix ();
5261 }
5362}
0 commit comments