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:
36:46bb54b669bc
finalizing code before writing report

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vsoltan 15:9d90f68e53da 1
vsoltan 15:9d90f68e53da 2 #ifndef GAME_STATE_H
vsoltan 15:9d90f68e53da 3 #define GAME_STATE_H
vsoltan 15:9d90f68e53da 4
vsoltan 15:9d90f68e53da 5 #include "mbed.h"
vsoltan 15:9d90f68e53da 6 #include "stdint.h"
vsoltan 17:32ae1f106002 7 #include "MbedJSONValue.h"
vsoltan 18:32fce82690a1 8 #include "graphics.h"
vsoltan 18:32fce82690a1 9 #include <string>
vsoltan 15:9d90f68e53da 10
vsoltan 15:9d90f68e53da 11 struct Coord {
vsoltan 15:9d90f68e53da 12 int8_t x;
vsoltan 15:9d90f68e53da 13 int8_t y;
vsoltan 15:9d90f68e53da 14 };
vsoltan 15:9d90f68e53da 15
vsoltan 18:32fce82690a1 16 class Graphics;
vsoltan 18:32fce82690a1 17
vsoltan 15:9d90f68e53da 18 class GameState {
vsoltan 15:9d90f68e53da 19 private:
vsoltan 15:9d90f68e53da 20 Coord p1_loc;
vsoltan 15:9d90f68e53da 21 Coord p2_loc;
vsoltan 15:9d90f68e53da 22 Coord ball_loc;
vsoltan 18:32fce82690a1 23 char is_done;
vsoltan 23:c38680c32552 24 char has_started;
vsoltan 18:32fce82690a1 25 char localPlayerNum;
vsoltan 23:c38680c32552 26 char lobbyHash[21];
vsoltan 37:8a0fc62a0512 27 int countdown;
vsoltan 27:fcc5fee18a24 28 int score[2];
vsoltan 15:9d90f68e53da 29 public:
vsoltan 19:58cc5465f647 30 GameState();
vsoltan 15:9d90f68e53da 31 Coord getPlayerOneLocation();
vsoltan 15:9d90f68e53da 32 Coord getPlayerTwoLocation();
vsoltan 37:8a0fc62a0512 33 Coord getPlayerLocation(char player);
vsoltan 15:9d90f68e53da 34 Coord getBallLocation();
vsoltan 23:c38680c32552 35 char *getLobbyHash();
vsoltan 19:58cc5465f647 36 char getLocalPlayerNum();
vsoltan 30:59e9a5409e65 37 char hasStarted();
vsoltan 37:8a0fc62a0512 38 char done();
vsoltan 37:8a0fc62a0512 39 int getCountdown();
vsoltan 27:fcc5fee18a24 40 int getPlayerOneScore();
vsoltan 27:fcc5fee18a24 41 int getPlayerTwoScore();
vsoltan 36:46bb54b669bc 42 int getPlayerScore(int player);
vsoltan 37:8a0fc62a0512 43 void setCountdown(int val);
vsoltan 27:fcc5fee18a24 44 void updateAndRender(MbedJSONValue *serverResponse, Graphics *gfx);
vsoltan 15:9d90f68e53da 45 };
vsoltan 15:9d90f68e53da 46
vsoltan 15:9d90f68e53da 47 #endif // GAME_STATE_H