Multiplayer framework in place (can now connect multiple clients and view them in game)
Fixed some bugs with multiplayer Changed from refptr<map<U8, Player> > to map<U8, refptr<player> >
This commit is contained in:
1 parent
7df681082a
commit
ba0bc9b77d
15 files changed
+329
-144
No files matched your search
@@ -1,4 +1,3 @@
|
||||
|
||||
#include <math.h>
|
||||
#include "HexTile.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef HEXTILE_H
|
||||
#define HEXTILE_H
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#include "Map.h"
|
||||
#include "HexTile.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef MAP_H
|
||||
#define MAP_H
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
+8
-1
@@ -1,8 +1,9 @@
|
||||
|
||||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
#include <string>
|
||||
#include "Types.h"
|
||||
#include "SFML/Config.hpp"
|
||||
|
||||
class Player
|
||||
{
|
||||
@@ -12,6 +13,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();
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@ void Timer::Update(void)
|
||||
{
|
||||
// Record the time step
|
||||
stepTime = ((myClock.getElapsedTime().asSeconds() / 1000.0f) * gameSpeed);
|
||||
//stepTime = ((((sf::Window*)screen)->GetFrameTime() / 1000.0f) * gameSpeed);
|
||||
myClock.restart();
|
||||
|
||||
// Add the time to the total time
|
||||
|
||||
+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
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef REFPTR_H
|
||||
#define REFPTR_H REFPTR_H
|
||||
|
||||
|
||||
Reference in new issue
Block a user