Compare commits
7 Commits
alpha-0.4.
...
sync
| Author | SHA1 | Date | |
|---|---|---|---|
| d2e42c33a0 | |||
| 8bddbce07a | |||
| add62fb24a | |||
| 68b389f938 | |||
| f3adb639c3 | |||
| 88a9020da7 | |||
| 0a814233a4 |
@@ -36,6 +36,8 @@ 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();
|
||||||
@@ -65,6 +67,8 @@ public:
|
|||||||
|
|
||||||
const TeamList& GetTeams() const { return m_Teams; }
|
const TeamList& GetTeams() const { return m_Teams; }
|
||||||
|
|
||||||
|
std::uint64_t GetGameStartTime() const { return m_GameStartTime; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace game
|
} // namespace game
|
||||||
|
|||||||
@@ -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; }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Lobby {
|
|||||||
private:
|
private:
|
||||||
Server* m_Server;
|
Server* m_Server;
|
||||||
bool m_GameStarted = 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:
|
||||||
|
|||||||
@@ -54,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
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
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:
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ 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; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
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;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
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;
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ ClientGame::~ClientGame() {
|
|||||||
void ClientGame::Tick(std::uint64_t delta) {
|
void ClientGame::Tick(std::uint64_t delta) {
|
||||||
game::Game::Tick(delta);
|
game::Game::Tick(delta);
|
||||||
m_WorldRenderer.Update();
|
m_WorldRenderer.Update();
|
||||||
if (m_GameState == game::GameState::Lobby && m_LobbyTime > 0) {
|
|
||||||
m_LobbyTime -= delta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientGame::HandlePacket(const protocol::PlayerJoinPacket* packet) {
|
void ClientGame::HandlePacket(const protocol::PlayerJoinPacket* packet) {
|
||||||
@@ -97,7 +94,8 @@ void ClientGame::HandlePacket(const protocol::ConnexionInfoPacket* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientGame::HandlePacket(const protocol::UpdateLobbyTimePacket* packet) {
|
void ClientGame::HandlePacket(const protocol::UpdateLobbyTimePacket* packet) {
|
||||||
m_LobbyTime = packet->GetRemainingTime();
|
m_GameStartTime = packet->GetStartTime();
|
||||||
|
m_LobbyStartTime = utils::GetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientGame::HandlePacket(const protocol::UpdateMoneyPacket* packet) {
|
void ClientGame::HandlePacket(const protocol::UpdateMoneyPacket* packet) {
|
||||||
|
|||||||
@@ -33,33 +33,39 @@ Lobby::Lobby(Server* server) : m_Server(server), m_Timer(1000, std::bind(&Lobby:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::Tick() {
|
void Lobby::Tick() {
|
||||||
if (m_GameStarted || m_StartTimerTime == 0)
|
if (m_GameStarted || m_StartTime == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (utils::GetTime() - m_StartTimerTime >= LobbyWaitingTime) {
|
if (utils::GetTime() >= m_StartTime) {
|
||||||
m_Server->GetGame().NotifyListeners(&game::GameListener::OnGameBegin);
|
m_Server->GetGame().NotifyListeners(&game::GameListener::OnGameBegin);
|
||||||
m_GameStarted = true;
|
m_GameStarted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Timer.Update();
|
//m_Timer.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::SendTimeRemaining() {
|
void Lobby::SendTimeRemaining() {
|
||||||
protocol::UpdateLobbyTimePacket packet(LobbyWaitingTime - (utils::GetTime() - m_StartTimerTime)); // converting second to millis
|
protocol::UpdateLobbyTimePacket packet(m_StartTime);
|
||||||
m_Server->BroadcastPacket(&packet);
|
m_Server->BroadcastPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::OnPlayerJoin(std::uint8_t playerID) {
|
void Lobby::OnPlayerJoin(std::uint8_t playerID) {
|
||||||
if (m_GameStarted)
|
if (m_GameStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
utils::LOG("(Server) Player Joined Lobby !");
|
utils::LOG("(Server) Player Joined Lobby !");
|
||||||
m_Players.push_back(playerID);
|
m_Players.push_back(playerID);
|
||||||
|
|
||||||
if (m_Players.size() == MIN_PLAYER_WAITING) { // start timer if a second player join the match
|
if (m_Players.size() == MIN_PLAYER_WAITING) { // start timer if a second player join the match
|
||||||
m_StartTimerTime = utils::GetTime();
|
m_StartTime = utils::GetTime() + static_cast<std::uint64_t>(LobbyWaitingTime);
|
||||||
m_Timer.Reset();
|
m_Timer.Reset();
|
||||||
SendTimeRemaining();
|
SendTimeRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// notify player that just arrived
|
||||||
|
protocol::UpdateLobbyTimePacket packet(m_StartTime);
|
||||||
|
m_Server->GetConnexions().at(playerID).SendPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::OnPlayerLeave(std::uint8_t playerID) {
|
void Lobby::OnPlayerLeave(std::uint8_t playerID) {
|
||||||
@@ -73,9 +79,8 @@ void Lobby::OnPlayerLeave(std::uint8_t playerID) {
|
|||||||
m_Players.erase(it);
|
m_Players.erase(it);
|
||||||
|
|
||||||
if (m_Players.size() == 1) {
|
if (m_Players.size() == 1) {
|
||||||
protocol::UpdateLobbyTimePacket packet(0);
|
m_StartTime = 0; // reset timer if there is only one player left
|
||||||
m_Server->BroadcastPacket(&packet);
|
SendTimeRemaining();
|
||||||
m_StartTimerTime = 0; // reset timer if there is only one player left
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ void Server::OnPlayerJoin(std::uint8_t id) {
|
|||||||
void Server::OnPlayerLeave(std::uint8_t id) {
|
void Server::OnPlayerLeave(std::uint8_t id) {
|
||||||
protocol::PlayerLeavePacket packet(id);
|
protocol::PlayerLeavePacket packet(id);
|
||||||
BroadcastPacket(&packet);
|
BroadcastPacket(&packet);
|
||||||
|
|
||||||
|
if (GetPlayers().empty()) {
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace server
|
} // namespace server
|
||||||
|
|||||||
@@ -39,7 +39,27 @@ static std::map<PacketType, PacketCreator> packets = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PacketPtr CreatePacket(PacketType type, DataBuffer& buffer) {
|
PacketPtr CreatePacket(PacketType type, DataBuffer& buffer) {
|
||||||
PacketPtr packet = packets[type]();
|
|
||||||
|
std::uint8_t packetTypeInt = static_cast<std::uint8_t>(type);
|
||||||
|
|
||||||
|
PacketPtr packet;
|
||||||
|
|
||||||
|
// we have a timed packet
|
||||||
|
if (packetTypeInt >> 7) {
|
||||||
|
std::uint64_t packetTime = 0;
|
||||||
|
buffer >> packetTime;
|
||||||
|
packetTypeInt &= 0x7F;
|
||||||
|
type = protocol::PacketType(packetTypeInt);
|
||||||
|
|
||||||
|
packet = packets[type]();
|
||||||
|
|
||||||
|
DelayedPacket* delayedPacket = reinterpret_cast<DelayedPacket*>(packet.get());
|
||||||
|
delayedPacket->SetPacketTime(packetTime);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
packet = packets[type]();
|
||||||
|
}
|
||||||
|
|
||||||
packet->Deserialize(buffer);
|
packet->Deserialize(buffer);
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "protocol/PacketHandler.h"
|
#include "protocol/PacketHandler.h"
|
||||||
#include "protocol/Packets.h"
|
#include "protocol/Packets.h"
|
||||||
|
|
||||||
#define REGISTER_DISPATCH_CLASS(className) void className::Dispatch(PacketHandler* handler) const { \
|
#define REGISTER_DISPATCH(className) void className::Dispatch(PacketHandler* handler) const { \
|
||||||
handler->HandlePacket(this);\
|
handler->HandlePacket(this);\
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,32 +13,37 @@ void Packet::WritePacketID(DataBuffer& data, bool packetID) const {
|
|||||||
data << GetID();
|
data << GetID();
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_DISPATCH_CLASS(PlayerLoginPacket)
|
void DelayedPacket::WritePacketID(DataBuffer& data, bool packetID) const {
|
||||||
REGISTER_DISPATCH_CLASS(WorldBeginDataPacket)
|
if (packetID)
|
||||||
REGISTER_DISPATCH_CLASS(WorldDataPacket)
|
data << static_cast<std::uint8_t>(GetID() | static_cast<std::uint8_t>(0x80)) << m_PacketTime;
|
||||||
REGISTER_DISPATCH_CLASS(KeepAlivePacket)
|
}
|
||||||
REGISTER_DISPATCH_CLASS(UpdateExpPacket)
|
|
||||||
REGISTER_DISPATCH_CLASS(UpdateMoneyPacket)
|
REGISTER_DISPATCH(PlayerLoginPacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpdateLobbyTimePacket)
|
REGISTER_DISPATCH(WorldBeginDataPacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpdateGameStatePacket)
|
REGISTER_DISPATCH(WorldDataPacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlayerListPacket)
|
REGISTER_DISPATCH(KeepAlivePacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlayerJoinPacket)
|
REGISTER_DISPATCH(UpdateExpPacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlayerLeavePacket)
|
REGISTER_DISPATCH(UpdateMoneyPacket)
|
||||||
REGISTER_DISPATCH_CLASS(ConnexionInfoPacket)
|
REGISTER_DISPATCH(UpdateLobbyTimePacket)
|
||||||
REGISTER_DISPATCH_CLASS(SelectTeamPacket)
|
REGISTER_DISPATCH(UpdateGameStatePacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpdatePlayerTeamPacket)
|
REGISTER_DISPATCH(PlayerListPacket)
|
||||||
REGISTER_DISPATCH_CLASS(DisconnectPacket)
|
REGISTER_DISPATCH(PlayerJoinPacket)
|
||||||
REGISTER_DISPATCH_CLASS(ServerTpsPacket)
|
REGISTER_DISPATCH(PlayerLeavePacket)
|
||||||
REGISTER_DISPATCH_CLASS(SpawnMobPacket)
|
REGISTER_DISPATCH(ConnexionInfoPacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlaceTowerPacket)
|
REGISTER_DISPATCH(SelectTeamPacket)
|
||||||
REGISTER_DISPATCH_CLASS(WorldAddTowerPacket)
|
REGISTER_DISPATCH(UpdatePlayerTeamPacket)
|
||||||
REGISTER_DISPATCH_CLASS(RemoveTowerPacket)
|
REGISTER_DISPATCH(DisconnectPacket)
|
||||||
REGISTER_DISPATCH_CLASS(SendMobsPacket)
|
REGISTER_DISPATCH(ServerTpsPacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpgradeTowerPacket)
|
REGISTER_DISPATCH(SpawnMobPacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpdateCastleLifePacket)
|
REGISTER_DISPATCH(PlaceTowerPacket)
|
||||||
REGISTER_DISPATCH_CLASS(UpdateMobStatesPacket)
|
REGISTER_DISPATCH(WorldAddTowerPacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlayerBuyItemPacket)
|
REGISTER_DISPATCH(RemoveTowerPacket)
|
||||||
REGISTER_DISPATCH_CLASS(PlayerBuyMobUpgradePacket)
|
REGISTER_DISPATCH(SendMobsPacket)
|
||||||
|
REGISTER_DISPATCH(UpgradeTowerPacket)
|
||||||
|
REGISTER_DISPATCH(UpdateCastleLifePacket)
|
||||||
|
REGISTER_DISPATCH(UpdateMobStatesPacket)
|
||||||
|
REGISTER_DISPATCH(PlayerBuyItemPacket)
|
||||||
|
REGISTER_DISPATCH(PlayerBuyMobUpgradePacket)
|
||||||
|
|
||||||
} // namespace protocol
|
} // namespace protocol
|
||||||
} // namespace td
|
} // namespace td
|
||||||
@@ -7,12 +7,12 @@ DataBuffer UpdateLobbyTimePacket::Serialize(bool packetID) const {
|
|||||||
DataBuffer data;
|
DataBuffer data;
|
||||||
|
|
||||||
WritePacketID(data, packetID);
|
WritePacketID(data, packetID);
|
||||||
data << m_RemainingTime;
|
data << m_StartTime;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateLobbyTimePacket::Deserialize(DataBuffer& data) {
|
void UpdateLobbyTimePacket::Deserialize(DataBuffer& data) {
|
||||||
data >> m_RemainingTime;
|
data >> m_StartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace protocol
|
} // namespace protocol
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ void GameMenu::ShowTeamSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMenu::ShowLobbyProgress() {
|
void GameMenu::ShowLobbyProgress() {
|
||||||
const int timePassed = server::Lobby::LobbyWaitingTime - GetClient()->GetGame().GetLobbyTime();
|
const std::uint64_t waitTime = GetClient()->GetGame().GetGameStartTime() - GetClient()->GetGame().GetLobbyStartTime();
|
||||||
const float progress = (float)timePassed / (float)(server::Lobby::LobbyWaitingTime);
|
const std::uint64_t timeRemaining = GetClient()->GetGame().GetGameStartTime() - utils::GetTime();
|
||||||
|
const float progress = static_cast<float>(timeRemaining) / static_cast<float>(waitTime);
|
||||||
|
|
||||||
if (progress > 0 && progress < 1) {
|
if (progress > 0 && progress < 1) {
|
||||||
ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f), std::string(std::to_string(GetClient()->GetGame().GetLobbyTime() / 1000) + "s").c_str());
|
ImGui::ProgressBar(1.0f - progress, ImVec2(0.0f, 0.0f), std::string(std::to_string(timeRemaining / 1000) + "s").c_str());
|
||||||
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||||
ImGui::Text("Time Remaining");
|
ImGui::Text("Time Remaining");
|
||||||
} else {
|
} else {
|
||||||
@@ -86,7 +88,7 @@ void GameMenu::ShowLobbyProgress() {
|
|||||||
|
|
||||||
void GameMenu::ShowTPS() {
|
void GameMenu::ShowTPS() {
|
||||||
ImGui::Text("Server TPS : %.1f", GetClient()->GetConnexion().GetServerTPS());
|
ImGui::Text("Server TPS : %.1f", GetClient()->GetConnexion().GetServerTPS());
|
||||||
ImGui::Text("Server MSPT : %i", (int)GetClient()->GetConnexion().GetServerMSPT());
|
ImGui::Text("Server MSPT : %i", static_cast<int>(GetClient()->GetConnexion().GetServerMSPT()));
|
||||||
ImGui::Text("Server Ping : %i", GetClient()->GetConnexion().GetServerPing());
|
ImGui::Text("Server Ping : %i", GetClient()->GetConnexion().GetServerPing());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ namespace gui {
|
|||||||
|
|
||||||
SummonMenu::SummonMenu(client::Client* client) : GuiWidget(client), m_MenuOpened(true) {
|
SummonMenu::SummonMenu(client::Client* client) : GuiWidget(client), m_MenuOpened(true) {
|
||||||
m_Values.fill(0);
|
m_Values.fill(0);
|
||||||
|
#ifdef NDEBUG
|
||||||
SetCooldown(10);
|
SetCooldown(10);
|
||||||
|
#else
|
||||||
|
SetCooldown(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SummonMenu::SetCooldown(float cooldown) {
|
void SummonMenu::SetCooldown(float cooldown) {
|
||||||
|
|||||||
Reference in New Issue
Block a user