refactor: create MainMenu and GameMenu classes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
|
||||
#include "network/TCPListener.h"
|
||||
#include "protocol/Protocol.h"
|
||||
@@ -11,9 +12,6 @@
|
||||
#include "ServerConnexion.h"
|
||||
#include "Lobby.h"
|
||||
|
||||
//#define LOBBY_WAITING_TIME 2 * 60 * 1000
|
||||
#define LOBBY_WAITING_TIME 5 * 1000
|
||||
|
||||
#define SERVER_TPS 20
|
||||
#define SERVER_TICK 1000 / SERVER_TPS
|
||||
|
||||
@@ -58,12 +56,14 @@ private:
|
||||
ServerGame m_Game{ this };
|
||||
Lobby m_Lobby{ this };
|
||||
TickCounter m_TickCounter;
|
||||
|
||||
std::thread m_Thread;
|
||||
bool m_ServerRunning;
|
||||
public:
|
||||
Server(const std::string& worldFilePath);
|
||||
virtual ~Server() {}
|
||||
|
||||
bool start(std::uint16_t port);
|
||||
void tick(std::uint64_t delta);
|
||||
void stop();
|
||||
|
||||
void lauchGame();
|
||||
@@ -88,6 +88,10 @@ private:
|
||||
void accept();
|
||||
void updateSockets();
|
||||
|
||||
void startThread();
|
||||
void stopThread();
|
||||
void tick(std::uint64_t delta);
|
||||
|
||||
void OnPlayerJoin(std::uint8_t id);
|
||||
void OnPlayerLeave(std::uint8_t id);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user