Compare commits
7 Commits
doc-action
...
sync
| Author | SHA1 | Date | |
|---|---|---|---|
| d2e42c33a0 | |||
| 8bddbce07a | |||
| add62fb24a | |||
| 68b389f938 | |||
| f3adb639c3 | |||
| 88a9020da7 | |||
| 0a814233a4 |
@@ -1,41 +0,0 @@
|
|||||||
name: Linux arm64
|
|
||||||
run-name: Build And Test Code
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Install deps
|
|
||||||
run : |
|
|
||||||
apt update
|
|
||||||
apt install -y libsdl2-dev libglew-dev
|
|
||||||
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache Build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
'build'
|
|
||||||
'.xmake'
|
|
||||||
key: ${{ runner.os }}-td
|
|
||||||
|
|
||||||
- name: Prepare Xmake
|
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
|
||||||
with:
|
|
||||||
xmake-version: branch@master
|
|
||||||
actions-cache-folder: '.xmake-cache'
|
|
||||||
actions-cache-key: 'ubuntu'
|
|
||||||
|
|
||||||
- name: XMake config
|
|
||||||
run: xmake f -p linux -y --root
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: xmake --root
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: xmake test --root
|
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define SAFE_CHECK(expr) if(!(expr)) return
|
|
||||||
|
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
static constexpr float PI = 3.141592653f;
|
static constexpr float PI = 3.141592653f;
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "GuiWidget.h"
|
|
||||||
#include "server/Server.h"
|
|
||||||
|
|
||||||
namespace td {
|
|
||||||
namespace gui {
|
|
||||||
|
|
||||||
class ServerGui : public GuiWidget {
|
|
||||||
private:
|
|
||||||
server::Server* m_Server;
|
|
||||||
public:
|
|
||||||
ServerGui(client::Client* client, server::Server* server);
|
|
||||||
|
|
||||||
virtual void Render();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace gui
|
|
||||||
} // namespace td
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/Team.h"
|
#include "game/Team.h"
|
||||||
#include "td/game/World.h"
|
#include "game/World.h"
|
||||||
#include "td/game/Player.h"
|
#include "game/Player.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace game {
|
namespace game {
|
||||||
@@ -36,14 +36,14 @@ protected:
|
|||||||
TeamList m_Teams = { Team{TeamColor::Red}, Team{TeamColor::Blue} };
|
TeamList m_Teams = { Team{TeamColor::Red}, Team{TeamColor::Blue} };
|
||||||
GameState m_GameState = GameState::Lobby;
|
GameState m_GameState = GameState::Lobby;
|
||||||
PlayerList m_Players;
|
PlayerList m_Players;
|
||||||
|
|
||||||
|
std::uint64_t m_GameStartTime = 0;
|
||||||
public:
|
public:
|
||||||
Game(World* world);
|
Game(World* world);
|
||||||
virtual ~Game();
|
virtual ~Game();
|
||||||
|
|
||||||
virtual void Tick(std::uint64_t delta);
|
virtual void Tick(std::uint64_t delta);
|
||||||
|
|
||||||
virtual void Reset();
|
|
||||||
|
|
||||||
Team& GetRedTeam() { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
Team& GetRedTeam() { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
||||||
const Team& GetRedTeam() const { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
const Team& GetRedTeam() const { return m_Teams[static_cast<std::uint8_t>(TeamColor::Red)]; }
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
|
|
||||||
const TeamList& GetTeams() const { return m_Teams; }
|
const TeamList& GetTeams() const { return m_Teams; }
|
||||||
|
|
||||||
void RemovePlayer(PlayerID pId);
|
std::uint64_t GetGameStartTime() const { return m_GameStartTime; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/network/TCPSocket.h"
|
#include "network/TCPSocket.h"
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
#include "td/protocol/PacketDispatcher.h"
|
#include "protocol/PacketDispatcher.h"
|
||||||
#include "td/game/Player.h"
|
#include "game/Player.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
#include "Towers.h"
|
#include "Towers.h"
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "Team.h"
|
#include "Team.h"
|
||||||
|
|
||||||
#include "td/misc/ObjectNotifier.h"
|
#include "misc/ObjectNotifier.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
utils::CooldownTimer m_AttackTimer;
|
utils::CooldownTimer m_AttackTimer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mob(MobID id, MobLevel level, PlayerID sender) : m_ID(id), m_Sender(sender), m_Level(level),
|
Mob(MobID id, MobLevel level, PlayerID sender) : m_Sender(sender), m_Level(level),
|
||||||
m_HitCooldown(0), m_EffectFireTimer(1000), m_EffectPoisonTimer(1000),
|
m_HitCooldown(0), m_EffectFireTimer(1000), m_EffectPoisonTimer(1000),
|
||||||
m_EffectHealTimer(1000), m_CastleTarget(nullptr), m_AttackTimer(1000) {
|
m_EffectHealTimer(1000), m_CastleTarget(nullptr), m_AttackTimer(1000) {
|
||||||
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "td/game/Team.h"
|
#include "game/Team.h"
|
||||||
#include "td/game/PlayerUpgrades.h"
|
#include "game/PlayerUpgrades.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace game {
|
namespace game {
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
|
|
||||||
#include "td/misc/Shapes.h"
|
#include "misc/Shapes.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -74,7 +74,6 @@ public:
|
|||||||
|
|
||||||
void AddPlayer(Player* newPlayer);
|
void AddPlayer(Player* newPlayer);
|
||||||
void RemovePlayer(const Player* player);
|
void RemovePlayer(const Player* player);
|
||||||
void ClearPlayers();
|
|
||||||
|
|
||||||
TeamColor GetColor() const;
|
TeamColor GetColor() const;
|
||||||
|
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "td/misc/Time.h"
|
#include "misc/Time.h"
|
||||||
#include "td/misc/Shapes.h"
|
#include "misc/Shapes.h"
|
||||||
|
|
||||||
#include "td/game/Types.h"
|
#include "game/Types.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace game {
|
namespace game {
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
// include Log for every files
|
// include Log for every files
|
||||||
#include "td/misc/Log.h"
|
#include "misc/Log.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace game {
|
namespace game {
|
||||||
@@ -171,10 +171,7 @@ public:
|
|||||||
|
|
||||||
void Tick(std::uint64_t delta);
|
void Tick(std::uint64_t delta);
|
||||||
|
|
||||||
void Reset(); // clear mobs and towers
|
|
||||||
|
|
||||||
void SpawnMobAt(MobID id, MobType type, std::uint8_t level, PlayerID sender, float x, float y, Direction dir);
|
void SpawnMobAt(MobID id, MobType type, std::uint8_t level, PlayerID sender, float x, float y, Direction dir);
|
||||||
MobPtr RemoveMob(MobID id);
|
|
||||||
|
|
||||||
TowerPtr PlaceTowerAt(TowerID id, TowerType type, std::int32_t x, std::int32_t y, PlayerID builder);
|
TowerPtr PlaceTowerAt(TowerID id, TowerType type, std::int32_t x, std::int32_t y, PlayerID builder);
|
||||||
TowerPtr RemoveTower(TowerID id);
|
TowerPtr RemoveTower(TowerID id);
|
||||||
@@ -220,9 +217,7 @@ public:
|
|||||||
|
|
||||||
const TeamList& GetTeams() const;
|
const TeamList& GetTeams() const;
|
||||||
|
|
||||||
TowerList& GetTowers() { return m_Towers; }
|
|
||||||
const TowerList& GetTowers() const { return m_Towers; }
|
const TowerList& GetTowers() const { return m_Towers; }
|
||||||
|
|
||||||
TowerPtr GetTowerById(TowerID tower);
|
TowerPtr GetTowerById(TowerID tower);
|
||||||
|
|
||||||
const Player* GetPlayerById(PlayerID id) const;
|
const Player* GetPlayerById(PlayerID id) const;
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "client/ClientConnexion.h"
|
#include "ClientConnexion.h"
|
||||||
#include "client/game/ClientGame.h"
|
#include "ClientGame.h"
|
||||||
|
|
||||||
#include "td/game/Team.h"
|
#include "game/Team.h"
|
||||||
#include "td/game/Player.h"
|
#include "game/Player.h"
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/protocol/packets/SendMobsPacket.h"
|
#include "protocol/packets/SendMobsPacket.h"
|
||||||
|
|
||||||
#include "client/render/Renderer.h"
|
#include "render/Renderer.h"
|
||||||
|
|
||||||
#include "td/network/Network.h"
|
#include "network/Network.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace client {
|
namespace client {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
#include "td/network/TCPSocket.h"
|
#include "network/TCPSocket.h"
|
||||||
#include "td/network/Connexion.h"
|
#include "game/Connexion.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace client {
|
namespace client {
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
|
|
||||||
#include "WorldClient.h"
|
#include "WorldClient.h"
|
||||||
|
|
||||||
#include "client/render/WorldRenderer.h"
|
#include "render/WorldRenderer.h"
|
||||||
#include "client/render/Renderer.h"
|
#include "render/Renderer.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace client {
|
namespace client {
|
||||||
@@ -18,7 +18,7 @@ class ClientGame : public protocol::PacketHandler, public game::Game {
|
|||||||
private:
|
private:
|
||||||
Client* m_Client;
|
Client* m_Client;
|
||||||
std::uint8_t m_ConnexionID;
|
std::uint8_t m_ConnexionID;
|
||||||
std::uint32_t m_LobbyTime = 0;
|
std::uint64_t m_LobbyStartTime = 0;
|
||||||
game::Player* m_Player = nullptr;
|
game::Player* m_Player = nullptr;
|
||||||
render::Renderer* m_Renderer;
|
render::Renderer* m_Renderer;
|
||||||
client::WorldClient m_WorldClient;
|
client::WorldClient m_WorldClient;
|
||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
void RenderWorld();
|
void RenderWorld();
|
||||||
|
|
||||||
std::uint32_t GetLobbyTime() const { return m_LobbyTime; }
|
std::uint64_t GetLobbyStartTime() const { return m_LobbyStartTime; }
|
||||||
const game::Player* GetPlayer() const { return m_Player; }
|
const game::Player* GetPlayer() const { return m_Player; }
|
||||||
const WorldClient& GetWorld() const { return m_WorldClient; }
|
const WorldClient& GetWorld() const { return m_WorldClient; }
|
||||||
Client* GetClient() const { return m_Client; }
|
Client* GetClient() const { return m_Client; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/World.h"
|
#include "game/World.h"
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace client {
|
namespace client {
|
||||||
@@ -13,14 +13,12 @@ private:
|
|||||||
ClientGame* m_Game;
|
ClientGame* m_Game;
|
||||||
public:
|
public:
|
||||||
WorldClient(ClientGame* game);
|
WorldClient(ClientGame* game);
|
||||||
virtual ~WorldClient();
|
|
||||||
|
|
||||||
virtual void HandlePacket(const protocol::WorldBeginDataPacket* packet) override;
|
virtual void HandlePacket(const protocol::WorldBeginDataPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::WorldDataPacket* packet) override;
|
virtual void HandlePacket(const protocol::WorldDataPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::SpawnMobPacket* packet) override;
|
virtual void HandlePacket(const protocol::SpawnMobPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::UpgradeTowerPacket* packet) override;
|
virtual void HandlePacket(const protocol::UpgradeTowerPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::WorldAddTowerPacket* packet) override;
|
virtual void HandlePacket(const protocol::WorldAddTowerPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::RemoveMobPacket* packet) override;
|
|
||||||
virtual void HandlePacket(const protocol::RemoveTowerPacket* packet) override;
|
virtual void HandlePacket(const protocol::RemoveTowerPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::UpdateMobStatesPacket* packet) override;
|
virtual void HandlePacket(const protocol::UpdateMobStatesPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::UpdateCastleLifePacket* packet) override;
|
virtual void HandlePacket(const protocol::UpdateCastleLifePacket* packet) override;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "td/misc/Time.h"
|
#include "misc/Time.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace server {
|
namespace server {
|
||||||
@@ -12,8 +12,8 @@ class Server;
|
|||||||
class Lobby {
|
class Lobby {
|
||||||
private:
|
private:
|
||||||
Server* m_Server;
|
Server* m_Server;
|
||||||
bool m_LobbyOpened = false;
|
bool m_GameStarted = false;
|
||||||
std::uint64_t m_StartTimerTime = 0;
|
std::uint64_t m_StartTime = 0;
|
||||||
std::vector<std::uint8_t> m_Players;
|
std::vector<std::uint8_t> m_Players;
|
||||||
utils::AutoTimer m_Timer;
|
utils::AutoTimer m_Timer;
|
||||||
public:
|
public:
|
||||||
@@ -22,8 +22,6 @@ public:
|
|||||||
void OnPlayerJoin(std::uint8_t playerID);
|
void OnPlayerJoin(std::uint8_t playerID);
|
||||||
void OnPlayerLeave(std::uint8_t playerID);
|
void OnPlayerLeave(std::uint8_t playerID);
|
||||||
|
|
||||||
void OpenLobby();
|
|
||||||
|
|
||||||
void SendTimeRemaining();
|
void SendTimeRemaining();
|
||||||
|
|
||||||
void Tick();
|
void Tick();
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "td/network/TCPListener.h"
|
#include "network/TCPListener.h"
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/protocol/PacketDispatcher.h"
|
#include "protocol/PacketDispatcher.h"
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
#include "server/game/ServerGame.h"
|
#include "ServerGame.h"
|
||||||
#include "server/ServerConnexion.h"
|
#include "ServerConnexion.h"
|
||||||
#include "server/Lobby.h"
|
#include "Lobby.h"
|
||||||
|
|
||||||
#define SERVER_TPS 20
|
#define SERVER_TPS 20
|
||||||
#define SERVER_TICK 1000 / SERVER_TPS
|
#define SERVER_TICK 1000 / SERVER_TPS
|
||||||
@@ -63,23 +63,17 @@ private:
|
|||||||
std::thread m_Thread;
|
std::thread m_Thread;
|
||||||
bool m_ServerRunning;
|
bool m_ServerRunning;
|
||||||
public:
|
public:
|
||||||
Server();
|
Server(const std::string& worldFilePath);
|
||||||
virtual ~Server();
|
virtual ~Server();
|
||||||
|
|
||||||
bool Start(std::uint16_t port, bool blocking);
|
bool Start(std::uint16_t port);
|
||||||
void Stop(); // force the server to stop
|
void Stop(); // force the server to stop
|
||||||
void Close(); // at the end of a game
|
void Close(); // at the end of a game
|
||||||
|
|
||||||
void Restart(); // go back to lobby state
|
|
||||||
|
|
||||||
bool LoadMap(const std::string& worldFilePath);
|
|
||||||
bool IsMapLoaded();
|
|
||||||
|
|
||||||
void RemoveConnexion(std::uint8_t connexionID);
|
void RemoveConnexion(std::uint8_t connexionID);
|
||||||
|
|
||||||
void BroadcastPacket(const protocol::Packet* packet);
|
void BroadcastPacket(const protocol::Packet* packet);
|
||||||
|
|
||||||
float GetMSPT() const { return m_TickCounter.GetMSPT(); }
|
|
||||||
float GetTPS() const { return m_TickCounter.GetTPS(); }
|
float GetTPS() const { return m_TickCounter.GetTPS(); }
|
||||||
|
|
||||||
bool IsRunning() { return m_ServerRunning; }
|
bool IsRunning() { return m_ServerRunning; }
|
||||||
@@ -101,7 +95,6 @@ private:
|
|||||||
void Clean();
|
void Clean();
|
||||||
void StartThread();
|
void StartThread();
|
||||||
void StopThread();
|
void StopThread();
|
||||||
void ServerLoop();
|
|
||||||
void Tick(std::uint64_t delta);
|
void Tick(std::uint64_t delta);
|
||||||
|
|
||||||
void OnPlayerJoin(std::uint8_t id);
|
void OnPlayerJoin(std::uint8_t id);
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/network/TCPSocket.h"
|
#include "network/TCPSocket.h"
|
||||||
#include "td/protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
#include "td/protocol/PacketDispatcher.h"
|
#include "protocol/PacketDispatcher.h"
|
||||||
#include "td/game/Player.h"
|
#include "game/Player.h"
|
||||||
#include "td/network/Connexion.h"
|
#include "game/Connexion.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace server {
|
namespace server {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
#include "td/misc/Time.h"
|
#include "misc/Time.h"
|
||||||
#include "ServerWorld.h"
|
#include "ServerWorld.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@@ -23,8 +23,6 @@ public:
|
|||||||
ServerWorld* GetServerWorld() { return &m_ServerWorld; }
|
ServerWorld* GetServerWorld() { return &m_ServerWorld; }
|
||||||
|
|
||||||
virtual void Tick(std::uint64_t delta);
|
virtual void Tick(std::uint64_t delta);
|
||||||
virtual void Reset() override;
|
|
||||||
|
|
||||||
void StartGame();
|
void StartGame();
|
||||||
|
|
||||||
// GameListener
|
// GameListener
|
||||||
@@ -33,9 +31,6 @@ public:
|
|||||||
virtual void OnGameBegin() override;
|
virtual void OnGameBegin() override;
|
||||||
virtual void OnGameEnd() override;
|
virtual void OnGameEnd() override;
|
||||||
virtual void OnGameClose() override;
|
virtual void OnGameClose() override;
|
||||||
|
|
||||||
virtual void OnPlayerJoin(game::PlayerID id) override;
|
|
||||||
virtual void OnPlayerLeave(game::PlayerID id) override;
|
|
||||||
private:
|
private:
|
||||||
void BalanceTeams();
|
void BalanceTeams();
|
||||||
void InitPlayerStats();
|
void InitPlayerStats();
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/World.h"
|
#include "game/World.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace server {
|
namespace server {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "td/network/Socket.h"
|
#include "network/Socket.h"
|
||||||
#include "td/network/IPAddress.h"
|
#include "network/IPAddress.h"
|
||||||
#include "td/network/UDPSocket.h"
|
#include "network/UDPSocket.h"
|
||||||
#include "td/network/TCPSocket.h"
|
#include "network/TCPSocket.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace network {
|
namespace network {
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "td/misc/DataBuffer.h"
|
#include "misc/DataBuffer.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef NETWORK_TCP_SOCKET_H_
|
#ifndef NETWORK_TCP_SOCKET_H_
|
||||||
#define NETWORK_TCP_SOCKET_H_
|
#define NETWORK_TCP_SOCKET_H_
|
||||||
|
|
||||||
#include "td/network/IPAddress.h"
|
#include "network/IPAddress.h"
|
||||||
#include "td/network/Socket.h"
|
#include "network/Socket.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef NETWORK_UDP_SOCKET_H_
|
#ifndef NETWORK_UDP_SOCKET_H_
|
||||||
#define NETWORK_UDP_SOCKET_H_
|
#define NETWORK_UDP_SOCKET_H_
|
||||||
|
|
||||||
#include "td/network/IPAddress.h"
|
#include "network/IPAddress.h"
|
||||||
#include "td/network/Socket.h"
|
#include "network/Socket.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/protocol/PacketsForward.h"
|
#include "protocol/PacketsForward.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -27,7 +27,6 @@ public:
|
|||||||
virtual void HandlePacket(const PlayerLeavePacket* packet) {}
|
virtual void HandlePacket(const PlayerLeavePacket* packet) {}
|
||||||
virtual void HandlePacket(const PlayerListPacket* packet) {}
|
virtual void HandlePacket(const PlayerListPacket* packet) {}
|
||||||
virtual void HandlePacket(const PlayerLoginPacket* packet) {}
|
virtual void HandlePacket(const PlayerLoginPacket* packet) {}
|
||||||
virtual void HandlePacket(const RemoveMobPacket* packet) {}
|
|
||||||
virtual void HandlePacket(const RemoveTowerPacket* packet) {}
|
virtual void HandlePacket(const RemoveTowerPacket* packet) {}
|
||||||
virtual void HandlePacket(const SelectTeamPacket* packet) {}
|
virtual void HandlePacket(const SelectTeamPacket* packet) {}
|
||||||
virtual void HandlePacket(const SendMobsPacket* packet) {}
|
virtual void HandlePacket(const SendMobsPacket* packet) {}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "packets/PlayerLeavePacket.h"
|
#include "packets/PlayerLeavePacket.h"
|
||||||
#include "packets/PlayerListPacket.h"
|
#include "packets/PlayerListPacket.h"
|
||||||
#include "packets/PlayerLoginPacket.h"
|
#include "packets/PlayerLoginPacket.h"
|
||||||
#include "packets/RemoveMobPacket.h"
|
|
||||||
#include "packets/RemoveTowerPacket.h"
|
#include "packets/RemoveTowerPacket.h"
|
||||||
#include "packets/SelectTeamPacket.h"
|
#include "packets/SelectTeamPacket.h"
|
||||||
#include "packets/SendMobsPacket.h"
|
#include "packets/SendMobsPacket.h"
|
||||||
@@ -29,7 +29,6 @@ class UpdateCastleLifePacket;
|
|||||||
class UpdateMobStatesPacket;
|
class UpdateMobStatesPacket;
|
||||||
class PlayerBuyItemPacket;
|
class PlayerBuyItemPacket;
|
||||||
class PlayerBuyMobUpgradePacket;
|
class PlayerBuyMobUpgradePacket;
|
||||||
class RemoveMobPacket;
|
|
||||||
|
|
||||||
} // namespace protocol
|
} // namespace protocol
|
||||||
} // namespace td
|
} // namespace td
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/misc/DataBuffer.h"
|
#include "misc/DataBuffer.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ enum class PacketType : std::uint8_t {
|
|||||||
// client --> server
|
// client --> server
|
||||||
PlayerLogin = 0,
|
PlayerLogin = 0,
|
||||||
SelectTeam,
|
SelectTeam,
|
||||||
|
SpawnMob,
|
||||||
SendMobs,
|
SendMobs,
|
||||||
PlaceTower,
|
PlaceTower,
|
||||||
|
|
||||||
@@ -32,8 +33,6 @@ enum class PacketType : std::uint8_t {
|
|||||||
WorldAddTower,
|
WorldAddTower,
|
||||||
UpdateMobStates,
|
UpdateMobStates,
|
||||||
UpdateCastleLife,
|
UpdateCastleLife,
|
||||||
SpawnMob,
|
|
||||||
RemoveMob,
|
|
||||||
|
|
||||||
// client <--> server
|
// client <--> server
|
||||||
KeepAlive,
|
KeepAlive,
|
||||||
@@ -55,13 +54,37 @@ public:
|
|||||||
virtual void Deserialize(DataBuffer& data) = 0;
|
virtual void Deserialize(DataBuffer& data) = 0;
|
||||||
virtual void Dispatch(PacketHandler* handler) const = 0;
|
virtual void Dispatch(PacketHandler* handler) const = 0;
|
||||||
|
|
||||||
void WritePacketID(DataBuffer& data, bool packetID) const;
|
virtual void WritePacketID(DataBuffer& data, bool packetID) const;
|
||||||
|
|
||||||
virtual PacketType GetType() const = 0;
|
virtual PacketType GetType() const = 0;
|
||||||
std::uint8_t GetID() const { return static_cast<std::uint8_t>(GetType()); }
|
std::uint8_t GetID() const { return static_cast<std::uint8_t>(GetType()); }
|
||||||
|
|
||||||
|
virtual bool IsTimed() const { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class DelayedPacket : public Packet {
|
||||||
|
protected:
|
||||||
|
std::uint64_t m_PacketTime = 69;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DelayedPacket() {}
|
||||||
|
virtual ~DelayedPacket() {}
|
||||||
|
|
||||||
|
virtual DataBuffer Serialize(bool packetID = true) const = 0;
|
||||||
|
virtual void Deserialize(DataBuffer& data) = 0;
|
||||||
|
virtual void Dispatch(PacketHandler* handler) const = 0;
|
||||||
|
|
||||||
|
virtual void WritePacketID(DataBuffer& data, bool packetID) const override;
|
||||||
|
|
||||||
|
virtual PacketType GetType() const = 0;
|
||||||
|
|
||||||
|
virtual bool IsTimed() const override { return true; }
|
||||||
|
|
||||||
|
void SetPacketTime(std::uint64_t packetTime) { m_PacketTime = packetTime; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::unique_ptr<Packet> PacketPtr;
|
typedef std::unique_ptr<Packet> PacketPtr;
|
||||||
|
typedef std::unique_ptr<DelayedPacket> DelayedPacketPtr;
|
||||||
|
|
||||||
} // namespace protocol
|
} // namespace protocol
|
||||||
} // namespace td
|
} // namespace td
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class KeepAlivePacket : public Packet {
|
class KeepAlivePacket : public Packet{
|
||||||
private:
|
private:
|
||||||
std::uint64_t m_AliveID;
|
std::uint64_t m_AliveID;
|
||||||
public:
|
public:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class RemoveTowerPacket : public Packet {
|
class RemoveTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
public:
|
public:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class UpdateLobbyTimePacket : public Packet {
|
class UpdateLobbyTimePacket : public Packet {
|
||||||
private:
|
private:
|
||||||
std::uint32_t m_RemainingTime;
|
std::uint64_t m_StartTime; // unix millis
|
||||||
public:
|
public:
|
||||||
UpdateLobbyTimePacket() {}
|
UpdateLobbyTimePacket() {}
|
||||||
UpdateLobbyTimePacket(std::uint32_t remainingTime) : m_RemainingTime(remainingTime) {}
|
UpdateLobbyTimePacket(std::uint64_t startTime) : m_StartTime(startTime) {}
|
||||||
virtual ~UpdateLobbyTimePacket() {}
|
virtual ~UpdateLobbyTimePacket() {}
|
||||||
|
|
||||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||||
virtual void Deserialize(DataBuffer& data);
|
virtual void Deserialize(DataBuffer& data);
|
||||||
virtual void Dispatch(PacketHandler* handler) const;
|
virtual void Dispatch(PacketHandler* handler) const;
|
||||||
|
|
||||||
std::uint32_t GetRemainingTime() const { return m_RemainingTime; }
|
std::uint64_t GetStartTime() const { return m_StartTime; }
|
||||||
|
|
||||||
virtual PacketType GetType() const { return PacketType::UpdateLobbyTime; }
|
virtual PacketType GetType() const { return PacketType::UpdateLobbyTime; }
|
||||||
};
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
game::Direction GetMobDirection() const { return m_MobDirection; }
|
game::Direction GetMobDirection() const { return m_MobDirection; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateMobStatesPacket : public Packet {
|
class UpdateMobStatesPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
std::vector<MobState> m_MobStates;
|
std::vector<MobState> m_MobStates;
|
||||||
public:
|
public:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class UpgradeTowerPacket : public Packet {
|
class UpgradeTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
game::TowerLevel m_TowerLevel;
|
game::TowerLevel m_TowerLevel;
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class WorldAddTowerPacket : public Packet {
|
class WorldAddTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
std::int32_t m_TowerX, m_TowerY;
|
std::int32_t m_TowerX, m_TowerY;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/protocol/Protocol.h"
|
#include "protocol/Protocol.h"
|
||||||
#include "td/game/BaseGame.h"
|
#include "game/BaseGame.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "loader/GLLoader.h"
|
#include "loader/GLLoader.h"
|
||||||
#include "client/render/shaders/WorldShader.h"
|
#include "render/shaders/WorldShader.h"
|
||||||
#include "client/render/shaders/EntityShader.h"
|
#include "render/shaders/EntityShader.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace render {
|
namespace render {
|
||||||
@@ -58,7 +58,6 @@ public:
|
|||||||
void SetCamAngularMovement(const Vec2f& mov);
|
void SetCamAngularMovement(const Vec2f& mov);
|
||||||
void SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCursorPos);
|
void SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCursorPos);
|
||||||
void SetCamLook(const Vec2f& worldPos);
|
void SetCamLook(const Vec2f& worldPos);
|
||||||
void ResetCamLook();
|
|
||||||
|
|
||||||
void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; }
|
void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; }
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "client/render/loader/GLLoader.h"
|
#include "render/loader/GLLoader.h"
|
||||||
|
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/World.h"
|
#include "game/World.h"
|
||||||
|
|
||||||
#include "client/render/Renderer.h"
|
#include "render/Renderer.h"
|
||||||
#include "client/render/VertexCache.h"
|
#include "render/VertexCache.h"
|
||||||
|
|
||||||
#include "client/render/gui/TowerPlacePopup.h"
|
#include "render/gui/TowerPlacePopup.h"
|
||||||
#include "client/render/gui/TowerUpgradePopup.h"
|
#include "render/gui/TowerUpgradePopup.h"
|
||||||
#include "client/render/gui/MobTooltip.h"
|
#include "render/gui/MobTooltip.h"
|
||||||
#include "client/render/gui/CastleTooltip.h"
|
#include "render/gui/CastleTooltip.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ public:
|
|||||||
void Update();
|
void Update();
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
void ResetCam();
|
|
||||||
void SetCamPos(float camX, float camY);
|
void SetCamPos(float camX, float camY);
|
||||||
|
|
||||||
void MoveCam(float relativeX, float relativeY);
|
void MoveCam(float relativeX, float relativeY);
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "SummonMenu.h"
|
#include "SummonMenu.h"
|
||||||
#include "td/game/BaseGame.h"
|
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
class GameMenu : public GuiWidget, public game::GameListener {
|
class GameMenu : public GuiWidget {
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<SummonMenu> m_SummonMenu;
|
std::unique_ptr<SummonMenu> m_SummonMenu;
|
||||||
public:
|
public:
|
||||||
GameMenu(client::Client* client);
|
GameMenu(client::Client* client);
|
||||||
|
|
||||||
virtual void OnGameBegin();
|
|
||||||
|
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
private:
|
private:
|
||||||
void ShowTPS();
|
void ShowTPS();
|
||||||
@@ -21,8 +18,6 @@ private:
|
|||||||
void ShowPlayers();
|
void ShowPlayers();
|
||||||
void ShowLobbyProgress();
|
void ShowLobbyProgress();
|
||||||
void ShowTeamSelection();
|
void ShowTeamSelection();
|
||||||
|
|
||||||
void DisconnectButton();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "client/render/gui/imgui/imgui.h"
|
#include "render/gui/imgui/imgui.h"
|
||||||
#include "td/game/Team.h"
|
#include "game/Team.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace render {
|
namespace render {
|
||||||
@@ -4,15 +4,13 @@
|
|||||||
|
|
||||||
#include "imgui/imgui_filebrowser.h"
|
#include "imgui/imgui_filebrowser.h"
|
||||||
|
|
||||||
#include "server/Server.h"
|
#include "game/server/Server.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
class ServerGui;
|
|
||||||
|
|
||||||
class MainMenu : public GuiWidget {
|
class MainMenu : public GuiWidget {
|
||||||
private:
|
private:
|
||||||
bool m_TriedToConnect = false;
|
bool m_TriedToConnect = false;
|
||||||
@@ -24,7 +22,6 @@ private:
|
|||||||
imgui_addons::ImGuiFileBrowser m_FileDialog;
|
imgui_addons::ImGuiFileBrowser m_FileDialog;
|
||||||
|
|
||||||
std::unique_ptr<server::Server> m_Server;
|
std::unique_ptr<server::Server> m_Server;
|
||||||
std::unique_ptr<ServerGui> m_ServerGui;
|
|
||||||
public:
|
public:
|
||||||
MainMenu(client::Client* client);
|
MainMenu(client::Client* client);
|
||||||
~MainMenu();
|
~MainMenu();
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "GuiWidget.h"
|
#include "GuiWidget.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "td/game/Mobs.h"
|
#include "game/Mobs.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "client/render/gui/GuiManager.h"
|
#include "render/gui/GuiManager.h"
|
||||||
|
|
||||||
struct SDL_Window;
|
struct SDL_Window;
|
||||||
typedef void* SDL_GLContext;
|
typedef void* SDL_GLContext;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "GuiWidget.h"
|
#include "GuiWidget.h"
|
||||||
|
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "GuiWidget.h"
|
#include "GuiWidget.h"
|
||||||
|
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
@@ -107,7 +107,7 @@ namespace ImGui
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "client/render/GL.h"
|
#include "render/GL.h"
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_ES3
|
#define IMGUI_IMPL_OPENGL_LOADER_ES3
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef IMGUIFILEBROWSER_H
|
#ifndef IMGUIFILEBROWSER_H
|
||||||
#define IMGUIFILEBROWSER_H
|
#define IMGUIFILEBROWSER_H
|
||||||
|
|
||||||
#include "client/render/gui/imgui/imgui.h"
|
#include "render/gui/imgui/imgui.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/game/World.h"
|
#include "game/World.h"
|
||||||
#include "GLLoader.h"
|
#include "GLLoader.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "td/Defines.h"
|
#include "Defines.h"
|
||||||
#include "client/render/GL.h"
|
#include "render/GL.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace shader {
|
namespace shader {
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user