multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Revision:
33:98ba7b0b8c2b
Parent:
29:4708bfb863cb
Child:
36:46bb54b669bc
--- a/graphics.cpp	Sat Nov 28 03:22:06 2020 +0000
+++ b/graphics.cpp	Sat Nov 28 03:30:09 2020 +0000
@@ -89,14 +89,21 @@
 
 void Graphics::renderGameOver(GameState *gs) {
     reset(); 
-    tft->setTextColor(DEFAULT_TEXT_COLOR); 
+    tft->setTextColor(DEFAULT_TEXT_COLOR);
     tft->setTextCursor(15, 20); 
     tft->printf("Game Over"); 
     tft->setTextCursor(15, 40); 
-    tft->printf("Final Score %i : %i", 
-        gs->getPlayerOneScore(), gs->getPlayerTwoScore()); 
+    
+    bool winner = gs->getPlayerOneScore() > gs->getPlayerTwoScore() ? 0 : 1;  
+    
+    if (winner == gs->getLocalPlayerNum()) {
+        tft->printf("You won :)");
+    } else {
+        printf("You lost :("); 
+    }
+    
     tft->setTextCursor(15, 60); 
-    tft->printf("Press any button to play again!"); 
+    tft->printf("Press any button to play again!");
 }
 
 void Graphics::renderCountdown(GameState *gs) {