Multiplayer framework in place (can now connect multiple clients and view them in game)
This commit is contained in:
1 parent
3e178b4d97
commit
abd731f3ca
9 files changed
+308
-146
No files matched your search
@@ -1,10 +1,18 @@
|
||||
|
||||
#include "Player.h"
|
||||
#include <math.h>
|
||||
|
||||
Player::Player()
|
||||
{
|
||||
x = 0.0;
|
||||
y = 0.0;
|
||||
direction = 0.0;
|
||||
direction = M_PI_2;
|
||||
hover = 1.0;
|
||||
name = "";
|
||||
w_pressed = KEY_NOT_PRESSED;
|
||||
a_pressed = KEY_NOT_PRESSED;
|
||||
s_pressed = KEY_NOT_PRESSED;
|
||||
d_pressed = KEY_NOT_PRESSED;
|
||||
rel_mouse_movement = 0;
|
||||
updated = false;
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
#define PLAYER_H
|
||||
|
||||
#include <string>
|
||||
#include "Types.h"
|
||||
#include "SFML/Config.hpp"
|
||||
|
||||
class Player
|
||||
{
|
||||
@@ -12,6 +14,12 @@ class Player
|
||||
double y;
|
||||
double direction; /* 0 = East, M_PI_2 = North, M_PI = West, ... */
|
||||
double hover;
|
||||
sf::Uint8 w_pressed;
|
||||
sf::Uint8 a_pressed;
|
||||
sf::Uint8 s_pressed;
|
||||
sf::Uint8 d_pressed;
|
||||
sf::Int32 rel_mouse_movement;
|
||||
bool updated;
|
||||
|
||||
Player();
|
||||
};
|
||||
|
||||
+4
-1
@@ -4,6 +4,9 @@
|
||||
#define KEY_PRESSED 0xA5u
|
||||
#define KEY_NOT_PRESSED 0x5Au
|
||||
|
||||
|
||||
#define PLAYER_CONNECT 0x1Au
|
||||
#define PLAYER_DISCONNECT 0x2Bu
|
||||
#define PLAYER_DEATH 0x3Cu
|
||||
#define PLAYER_UPDATE 0x4Du
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user