multiplayer pong game for LPC 1768
Dependencies: mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt
graphics.cpp@18:32fce82690a1, 2020-11-15 (annotated)
- Committer:
- vsoltan
- Date:
- Sun Nov 15 21:55:35 2020 +0000
- Revision:
- 18:32fce82690a1
- Parent:
- 17:32ae1f106002
- Child:
- 19:58cc5465f647
added different types of server response and handling for each case
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsoltan | 16:7fd48cda0773 | 1 | |
vsoltan | 16:7fd48cda0773 | 2 | #include "graphics.h" |
vsoltan | 16:7fd48cda0773 | 3 | |
vsoltan | 16:7fd48cda0773 | 4 | Graphics::Graphics() { |
vsoltan | 17:32ae1f106002 | 5 | printf("\n\rInitializing Graphics: initializing TFT\n\r"); |
vsoltan | 16:7fd48cda0773 | 6 | this->tft = new Adafruit_ST7735(P_MOSI, P_MISO, P_SOCK, P_CS, P_RS, P_DC); |
vsoltan | 17:32ae1f106002 | 7 | printf("Initializing Graphics: optimizing display for resolution\n\r"); |
vsoltan | 17:32ae1f106002 | 8 | tft->initR(INITR_144GREENTAB); |
vsoltan | 17:32ae1f106002 | 9 | tft->setTextColor(ST7735_WHITE); |
vsoltan | 16:7fd48cda0773 | 10 | } |
vsoltan | 16:7fd48cda0773 | 11 | |
vsoltan | 16:7fd48cda0773 | 12 | void Graphics::renderLaunchScreen() { |
vsoltan | 17:32ae1f106002 | 13 | tft->fillScreen(ST7735_BLACK); |
vsoltan | 17:32ae1f106002 | 14 | tft->setTextCursor(20, 20); |
vsoltan | 17:32ae1f106002 | 15 | tft->printf("%s", "Multiplayer Pong"); |
vsoltan | 17:32ae1f106002 | 16 | tft->setTextCursor(20, 80); |
vsoltan | 17:32ae1f106002 | 17 | tft->printf("%s", "Press any button to continue."); |
vsoltan | 17:32ae1f106002 | 18 | } |
vsoltan | 17:32ae1f106002 | 19 | |
vsoltan | 18:32fce82690a1 | 20 | void Graphics::renderWaitingRoom() { |
vsoltan | 18:32fce82690a1 | 21 | tft->fillScreen(ST7735_GREEN); |
vsoltan | 18:32fce82690a1 | 22 | tft->setTextCursor(20, 20); |
vsoltan | 18:32fce82690a1 | 23 | tft->printf("%s", "Waiting For Player"); |
vsoltan | 18:32fce82690a1 | 24 | } |
vsoltan | 18:32fce82690a1 | 25 | |
vsoltan | 17:32ae1f106002 | 26 | void Graphics::renderBall(GameState *gs) { |
vsoltan | 16:7fd48cda0773 | 27 | |
vsoltan | 17:32ae1f106002 | 28 | } |
vsoltan | 17:32ae1f106002 | 29 | |
vsoltan | 17:32ae1f106002 | 30 | void Graphics::renderPlayers(GameState *gs) { |
vsoltan | 17:32ae1f106002 | 31 | } |
vsoltan | 16:7fd48cda0773 | 32 | |
vsoltan | 16:7fd48cda0773 | 33 | void Graphics::renderGameState(GameState *gs) { |
vsoltan | 17:32ae1f106002 | 34 | tft->fillScreen(ST7735_RED); |
vsoltan | 16:7fd48cda0773 | 35 | } |