multiplayer pong game for LPC 1768
Dependencies: mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt
Diff: graphics.cpp
- Revision:
- 19:58cc5465f647
- Parent:
- 18:32fce82690a1
- Child:
- 22:1c49e1fae846
--- a/graphics.cpp Sun Nov 15 21:55:35 2020 +0000 +++ b/graphics.cpp Sun Nov 15 22:45:48 2020 +0000 @@ -24,12 +24,20 @@ } void Graphics::renderBall(GameState *gs) { - + // erase previous ball location + Coord ball_loc = gs->getBallLocation(); + tft->drawPixel(ball_loc.x, ball_loc.y, ST7735_WHITE); } void Graphics::renderPlayers(GameState *gs) { + int8_t bottomPaddleRenderPos = gs->getPlayerLocation(gs->getLocalPlayerNum()).y; + int8_t topPaddleRenderPos = 127 - bottomPaddleRenderPos; + + } void Graphics::renderGameState(GameState *gs) { - tft->fillScreen(ST7735_RED); + tft->fillScreen(ST7735_BLACK); + renderBall(gs); + renderPlayers(gs); } \ No newline at end of file