From 934bc80b6212244e419f35547178dbd50c0c9953 Mon Sep 17 00:00:00 2001 From: Linda Andersson Date: Wed, 26 Feb 2014 11:53:33 +0100 Subject: [PATCH] InGame keys: Go to mainMenu with M. Exit client with ESC. Fix drop in drop out correctly. --- .../GameClient/GameClientState/GameState.cpp | 19 ++++++++++++++----- .../GameClient/GameClientState/GamingUI.cpp | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 556ddf03..c65aa7b4 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -153,19 +153,28 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa GameClientState::ClientState GameState::Update( float deltaTime ) { - GameStateUI::UIState UIstate = this->currGameUI->Update( deltaTime ); + GameStateUI::UIState UIstate = this->gameUI->Update( deltaTime ); switch (UIstate) { + case DanBias::Client::GameStateUI::UIState_shut_down: + { + this->privData->nextState = ClientState_Quit; + // disconnect + } + + break; case DanBias::Client::GameStateUI::UIState_same: break; case DanBias::Client::GameStateUI::UIState_gaming: break; case DanBias::Client::GameStateUI::UIState_main_menu: - //this->privData->nextState = - break; - case DanBias::Client::GameStateUI::UIState_shut_down: - this->privData->nextState = ClientState_Quit; + { + this->privData->nextState = ClientState_Main; + // disconnect + } + break; + default: break; } diff --git a/Code/Game/GameClient/GameClientState/GamingUI.cpp b/Code/Game/GameClient/GameClientState/GamingUI.cpp index 1486fdda..d12dfdb3 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.cpp +++ b/Code/Game/GameClient/GameClientState/GamingUI.cpp @@ -17,6 +17,7 @@ GamingUI::GamingUI() : this->camera = nullptr; this->plane = nullptr; this->text = nullptr; + this->nextState = GameStateUI::UIState_same; } GamingUI::GamingUI( InputClass *input, NetworkClient *connection, Camera_FPSV2 *camera ) : @@ -25,6 +26,7 @@ GamingUI::GamingUI( InputClass *input, NetworkClient *connection, Camera_FPSV2 * this->input = input; this->netClient = connection; this->camera = camera; + this->nextState = GameStateUI::UIState_same; } GamingUI::~GamingUI() { /* Do nothing */ } @@ -169,6 +171,10 @@ void GamingUI::ReadKeyInput() { this->nextState = GameStateUI::UIState_shut_down; } + if( this->input->IsKeyPressed(DIK_M) ) + { + this->nextState = GameStateUI::UIState_main_menu; + } // !DEGUG KEYS // TODO: implement sub-menu }