multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Committer:
vsoltan
Date:
Sun Nov 29 22:40:24 2020 +0000
Revision:
37:8a0fc62a0512
Parent:
29:4708bfb863cb
finalizing code before writing report

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vsoltan 16:7fd48cda0773 1
vsoltan 16:7fd48cda0773 2 #ifndef GRAPHICS_H
vsoltan 16:7fd48cda0773 3 #define GRAPHICS_H
vsoltan 16:7fd48cda0773 4
vsoltan 16:7fd48cda0773 5 #include "Adafruit_ST7735.h"
vsoltan 16:7fd48cda0773 6 #include "gamestate.h"
vsoltan 16:7fd48cda0773 7
vsoltan 16:7fd48cda0773 8 #define P_MOSI p5
vsoltan 16:7fd48cda0773 9 #define P_MISO p6
vsoltan 16:7fd48cda0773 10 #define P_SOCK p7
vsoltan 16:7fd48cda0773 11 #define P_CS p9
vsoltan 16:7fd48cda0773 12 #define P_RS p20
vsoltan 16:7fd48cda0773 13 #define P_DC p19
vsoltan 16:7fd48cda0773 14
vsoltan 22:1c49e1fae846 15 #define BACKGROUND_COLOR ST7735_BLACK
vsoltan 27:fcc5fee18a24 16 #define DEFAULT_TEXT_COLOR ST7735_WHITE
vsoltan 22:1c49e1fae846 17 #define LAUNCH_SCREEN_COLOR ST7735_BLACK
vsoltan 22:1c49e1fae846 18 #define WAITING_SCREEN_COLOR ST7735_BLACK
vsoltan 22:1c49e1fae846 19
vsoltan 24:05eb0b0ab554 20 #define OTHER_PADDLE_COLOR ST7735_WHITE
vsoltan 24:05eb0b0ab554 21 #define YOUR_PADDLE_COLOR ST7735_GREEN
vsoltan 24:05eb0b0ab554 22 #define BALL_COLOR ST7735_RED
vsoltan 23:c38680c32552 23
vsoltan 23:c38680c32552 24 #define PADDLE_WIDTH 30
vsoltan 23:c38680c32552 25 #define ELEVATION 5
vsoltan 23:c38680c32552 26
vsoltan 18:32fce82690a1 27 class GameState;
vsoltan 18:32fce82690a1 28
vsoltan 16:7fd48cda0773 29 class Graphics {
vsoltan 16:7fd48cda0773 30 private:
vsoltan 16:7fd48cda0773 31 Adafruit_ST7735 *tft;
vsoltan 16:7fd48cda0773 32 public:
vsoltan 16:7fd48cda0773 33 Graphics();
vsoltan 16:7fd48cda0773 34 void renderLaunchScreen();
vsoltan 18:32fce82690a1 35 void renderWaitingRoom();
vsoltan 37:8a0fc62a0512 36 void renderCountdown(GameState *gs);
vsoltan 16:7fd48cda0773 37 void renderGameState(GameState *gs);
vsoltan 17:32ae1f106002 38 void renderBall(GameState *gs);
vsoltan 17:32ae1f106002 39 void renderPlayers(GameState *gs);
vsoltan 27:fcc5fee18a24 40 void renderScore(GameState *gs);
vsoltan 29:4708bfb863cb 41 void renderGameOver(GameState *gs);
vsoltan 37:8a0fc62a0512 42 void eraseCountdown(GameState *gs);
vsoltan 23:c38680c32552 43 void eraseBall(GameState *gs);
vsoltan 23:c38680c32552 44 void erasePlayers(GameState *gs);
vsoltan 37:8a0fc62a0512 45 void eraseScore(GameState *gs);
vsoltan 23:c38680c32552 46 void eraseGameState(GameState *gs);
vsoltan 23:c38680c32552 47 void reset();
vsoltan 16:7fd48cda0773 48 };
vsoltan 16:7fd48cda0773 49
vsoltan 16:7fd48cda0773 50 #endif // GRAPHICS_H