add client disconnect button
This commit is contained in:
@@ -37,6 +37,9 @@ void Client::CloseConnection() {
|
||||
|
||||
protocol::DisconnectPacket packet;
|
||||
m_Connexion.SendPacket(&packet);
|
||||
|
||||
m_Game->SetGameState(game::GameState::Disconnected);
|
||||
m_Connexion.CloseConnection();
|
||||
}
|
||||
|
||||
void Client::Tick(std::uint64_t delta) {
|
||||
|
||||
@@ -24,6 +24,8 @@ void GameMenu::Render() {
|
||||
ShowPlayers();
|
||||
ShowLobbyProgress();
|
||||
ShowTeamSelection();
|
||||
ImGui::Separator();
|
||||
DisconnectButton();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -33,6 +35,8 @@ void GameMenu::Render() {
|
||||
ShowTPS();
|
||||
ShowStats();
|
||||
ShowPlayers();
|
||||
ImGui::Separator();
|
||||
DisconnectButton();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
@@ -95,5 +99,11 @@ void GameMenu::ShowStats() {
|
||||
ImGui::Text("EXP: %i", GetClient()->GetGame().GetPlayer()->GetExp());
|
||||
}
|
||||
|
||||
void GameMenu::DisconnectButton() {
|
||||
if (ImGui::Button("Disconnect")) {
|
||||
m_Client->CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gui
|
||||
} // namespace td
|
||||
|
||||
Reference in New Issue
Block a user