Revenge of the Mouse
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer LCD_fonts MMA8452 SDFileSystem mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
Diff: Game_Synchronizer/game_synchronizer.h
- Revision:
- 9:ee330b1ba394
- Parent:
- 8:e6dd05393290
- Child:
- 10:5da9b27e050e
--- a/Game_Synchronizer/game_synchronizer.h Thu Oct 22 09:52:53 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -#ifndef GAME_SYNC_H__ -#define GAME_SYNC_H__ - -#include <cmath> -#include "uLCD_4DGL.h" -#include "EthernetInterface.h" - -#define PLAYER1 true -#define PLAYER2 false - -#define SINGLE_PLAYER 0 -#define MULTI_PLAYER 1 - -#define PLAYER1_IP "192.168.2.1" -#define PLAYER2_IP "192.168.2.2" -#define SERVER_PORT 7 -#define ETH_PACKET_SIZE 1024 - - -class Game_Synchronizer -{ - -public : - - int p1_p2; - - enum Color - { - CLS_CMD, - BG_COLOR_CMD, - LINE_CMD, - CIRCLE_CMD, - FILLED_CIRCLE_CMD, - TRI_CMD, - RECT_CMD, - FILLED_RECT_CMD, - PIX_CMD - }; - - Game_Synchronizer(bool player); - - void init(uLCD_4DGL*, int); - - // Yes, this sucks. If you're smart, find a good way to do variable args and show me! - // Look into template metaprogramming! - - void draw(int CMD); - void draw(int CMD, int a); - void draw(int CMD, int a, int b); - void draw(int CMD, int a, int b, int c); - void draw(int CMD, int a, int b, int c, int d); - void draw(int CMD, int a, int b, int c, int d, int e); - void draw(int CMD, int a, int b, int c, int d, int e, int f); - void draw(int CMD, int a, int b, int c, int d, int e, int f, int g); - void _draw(int CMD, int a, int b, int c, int d, int e, int f, int g, char nArgs); - - - void background_color(int color); - void line(int sx, int sy, int ex, int ey, int color); - void circle(int x , int y , int radius, int color); - void filled_circle(int x , int y , int radius, int color); - void triangle(int a, int b, int c, int d , int e, int f, int col); - void rectangle(int a, int b, int c, int d, int col); - void filled_rectangle(int a, int b, int c, int d, int col); - void pixel(int a, int b, int col); - void cls(void); - - //void BLIT(int x1, int y1, int x2, int y2, int *colors); // I'll get to this one later. - - // Reads don't need to be done on the slave side. Hopefully both sides match! - int read_pixel(int x, int y); - - void set_button_state(int a, int b, int c, int d, int e); - - int* get_button_state(); - - void update(void); - - ~Game_Synchronizer(); - - private: - - int play_mode; - int buffer[ETH_PACKET_SIZE]; - int buffer_idx; - - TCPSocketServer* server; - TCPSocketConnection* sock; - EthernetInterface* eth; - - uLCD_4DGL* LCD; - - int buttons[5]; -}; - -#endif \ No newline at end of file