multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Committer:
vsoltan
Date:
Sat Nov 14 02:37:13 2020 +0000
Revision:
17:32ae1f106002
Parent:
15:9d90f68e53da
Child:
18:32fce82690a1
added menu to enter game, JSON de-serialization, and game state update.

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 15:9d90f68e53da 8
vsoltan 15:9d90f68e53da 9 struct Coord {
vsoltan 15:9d90f68e53da 10 int8_t x;
vsoltan 15:9d90f68e53da 11 int8_t y;
vsoltan 15:9d90f68e53da 12 };
vsoltan 15:9d90f68e53da 13
vsoltan 15:9d90f68e53da 14 class GameState {
vsoltan 15:9d90f68e53da 15 private:
vsoltan 15:9d90f68e53da 16 Coord p1_loc;
vsoltan 15:9d90f68e53da 17 Coord p2_loc;
vsoltan 15:9d90f68e53da 18 Coord ball_loc;
vsoltan 15:9d90f68e53da 19 bool is_done;
vsoltan 17:32ae1f106002 20 bool localPlayer;
vsoltan 15:9d90f68e53da 21 public:
vsoltan 15:9d90f68e53da 22 GameState();
vsoltan 15:9d90f68e53da 23 Coord getPlayerOneLocation();
vsoltan 15:9d90f68e53da 24 Coord getPlayerTwoLocation();
vsoltan 15:9d90f68e53da 25 Coord getBallLocation();
vsoltan 17:32ae1f106002 26 void update(MbedJSONValue *serverResponse);
vsoltan 15:9d90f68e53da 27 bool done();
vsoltan 17:32ae1f106002 28 void print();
vsoltan 15:9d90f68e53da 29 };
vsoltan 15:9d90f68e53da 30
vsoltan 15:9d90f68e53da 31 #endif // GAME_STATE_H