From 3bee35785abe549f683ac6ceaeb5d93310841492 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Thu, 20 Feb 2014 16:51:14 +0100 Subject: [PATCH] moved debug buttons to gameState --- .../GameClient/GameClientState/GameState.cpp | 58 ++++++++++++------- .../GameClient/GameClientState/GameState.h | 5 ++ .../GameClient/GameClientState/GamingUI.cpp | 29 ---------- .../GameClient/GameClientState/GamingUI.h | 7 --- 4 files changed, 41 insertions(+), 58 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index ce7a9158..631f4399 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -32,19 +32,6 @@ struct GameState::MyData ::std::map> *dynamicObjects; ::std::map> *lights; - bool key_forward; - bool key_backward; - bool key_strafeRight; - bool key_strafeLeft; - bool key_Shoot; - bool key_Jump; - - // DEGUG KEYS - bool key_Reload_Shaders; - bool key_Wireframe_Toggle; - bool renderWhireframe; - // !DEGUG KEYS - C_Player player; Camera_FPSV2 camera; @@ -75,11 +62,6 @@ bool GameState::Init( SharedStateContent &shared ) this->privData = new MyData(); - this->privData->key_forward = false; - this->privData->key_backward = false; - this->privData->key_strafeRight = false; - this->privData->key_strafeLeft = false; - this->privData->nextState = GameClientState::ClientState_Same; this->privData->nwClient = shared.network; this->privData->input = shared.input; @@ -100,9 +82,9 @@ bool GameState::Init( SharedStateContent &shared ) this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); // DEGUG KEYS - this->privData->key_Reload_Shaders = false; - this->privData->key_Wireframe_Toggle = false; - this->privData->renderWhireframe = false; + this->key_Reload_Shaders = false; + this->key_Wireframe_Toggle = false; + this->renderWhireframe = false; // !DEGUG KEYS auto light = this->privData->lights->begin(); @@ -189,6 +171,9 @@ GameClientState::ClientState GameState::Update( float deltaTime ) default: break; } + // DEBUG keybindings + ReadKeyInput(); + return this->privData->nextState; } @@ -219,7 +204,7 @@ bool GameState::Render() #ifdef _DEBUG //RB DEBUG render wire frame - if(this->privData->renderWhireframe) + if(this->renderWhireframe) { Oyster::Graphics::API::StartRenderWireFrame(); @@ -322,7 +307,36 @@ void GameState::ChangeState( ClientState next ) { this->privData->nextState = next; } +void GameState::ReadKeyInput() +{ + // DEGUG KEYS + // Reload shaders + if( this->privData->input->IsKeyPressed(DIK_R) ) + { + if( !this->key_Reload_Shaders ) + { +#ifdef _DEBUG + Oyster::Graphics::API::ReloadShaders(); +#endif + this->key_Reload_Shaders = true; + } + } + else + this->key_Reload_Shaders = false; + + // toggle wire frame render + if( this->privData->input->IsKeyPressed(DIK_T) ) + { + if( !this->key_Wireframe_Toggle ) + { + this->renderWhireframe = !this->renderWhireframe; + this->key_Wireframe_Toggle = true; + } + } + else + this->key_Wireframe_Toggle = false; +} const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState::NetEvent &message ) { if( message.args.type == NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend ) diff --git a/Code/Game/GameClient/GameClientState/GameState.h b/Code/Game/GameClient/GameClientState/GameState.h index 8935481d..5a9519ad 100644 --- a/Code/Game/GameClient/GameClientState/GameState.h +++ b/Code/Game/GameClient/GameClientState/GameState.h @@ -34,6 +34,11 @@ namespace DanBias { namespace Client ::Utility::DynamicMemory::UniquePointer privData; GameStateUI *currGameUI, *gameUI, *respawnUI; + // DEGUG KEYS + bool key_Reload_Shaders; + bool key_Wireframe_Toggle; + bool renderWhireframe; + // !DEGUG KEYS }; } } #endif \ No newline at end of file diff --git a/Code/Game/GameClient/GameClientState/GamingUI.cpp b/Code/Game/GameClient/GameClientState/GamingUI.cpp index 3c4dd73c..b57aff5d 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.cpp +++ b/Code/Game/GameClient/GameClientState/GamingUI.cpp @@ -163,35 +163,6 @@ void GamingUI::ReadKeyInput() else this->key_Jump = false; - - // DEGUG KEYS - - // Reload shaders - if( this->input->IsKeyPressed(DIK_R) ) - { - if( !this->key_Reload_Shaders ) - { -#ifdef _DEBUG - Oyster::Graphics::API::ReloadShaders(); -#endif - this->key_Reload_Shaders = true; - } - } - else - this->key_Reload_Shaders = false; - - // toggle wire frame render - if( this->input->IsKeyPressed(DIK_T) ) - { - if( !this->key_Wireframe_Toggle ) - { - this->renderWhireframe = !this->renderWhireframe; - this->key_Wireframe_Toggle = true; - } - } - else - this->key_Wireframe_Toggle = false; - if( this->input->IsKeyPressed(DIK_ESCAPE) ) { this->nextState = GameStateUI::UIState_shut_down; diff --git a/Code/Game/GameClient/GameClientState/GamingUI.h b/Code/Game/GameClient/GameClientState/GamingUI.h index 2e7fa5fe..af77fe0b 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.h +++ b/Code/Game/GameClient/GameClientState/GamingUI.h @@ -37,13 +37,6 @@ namespace DanBias { namespace Client bool key_Shoot; bool key_Jump; - // DEGUG KEYS - bool key_Reload_Shaders; - bool key_Wireframe_Toggle; - bool renderWhireframe; - // !DEGUG KEYS - - GamingUI(); void ReadKeyInput(); };