From 1725f05c4bd9662d8fcea27a578b2f84b952e58c Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Tue, 11 Feb 2014 15:06:46 +0100 Subject: [PATCH] GUI - GUI testing. --- .../GameClientState/Buttons/EventButtonGUI.h | 7 +++-- .../GameClientState/LoginState.cpp | 29 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h index 598d594d..9519a586 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h @@ -48,8 +48,11 @@ namespace DanBias virtual void Render() { - //Render att xPos and yPos - //With halfWidth and halfHeight + if(EventButton::Enabled()) + { + //Render att xPos and yPos + //With halfWidth and halfHeight + } } protected: diff --git a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp index 0a655e1f..05c766b9 100644 --- a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp @@ -8,6 +8,12 @@ using namespace DanBias::Client; +//Menu buttons +#include "Buttons/ButtonCircle.h" +#include "Buttons/ButtonRectangle.h" +#include "../Misc/EventHandler/EventHandler.h" +using namespace Oyster::Event; + struct LoginState::myData { myData(){} @@ -17,12 +23,12 @@ struct LoginState::myData int modelCount; // UI object // game client* + + //Menu button collection + EventButtonCollection* collection; + }privData; -#include "Buttons\ButtonCircle.h" -#include "Buttons\ButtonRectangle.h" -#include "../Misc/EventHandler/EventHandler.h" -using namespace Oyster::Event; enum TestEnum { @@ -33,10 +39,6 @@ enum TestEnum LoginState::LoginState(void) { - EventButtonCollection* collection = new EventButtonCollection; - EventHandler::Instance().AddCollection(collection); - - collection->AddButton(new ButtonRectangle(L"textureName.jpg", &LoginState::ButtonCallback, this, (void*)Options, 0.0f, 0.0f, 0.0f, 0.0f)); } void LoginState::ButtonCallback(Oyster::Event::ButtonEvent& e) @@ -68,8 +70,14 @@ bool LoginState::Init(Oyster::Network::NetworkClient* nwClient) privData = new myData(); this->nwClient = nwClient; // load models - LoadModels(L"UImodels.txt"); + //LoadModels(L"UImodels.txt"); InitCamera(Oyster::Math::Float3(0,0,5.4f)); + + //Create menu buttons + privData->collection = new EventButtonCollection; + EventHandler::Instance().AddCollection(privData->collection); + privData->collection->AddButton(new ButtonRectangle(L"textureName.jpg", &LoginState::ButtonCallback, this, (void*)Options, 0.0f, 0.0f, 0.0f, 0.0f)); + return true; } bool LoginState::LoadModels(std::wstring file) @@ -172,6 +180,9 @@ bool LoginState::Render() // render lights + //Render buttons + EventHandler::Instance().Render(); + Oyster::Graphics::API::EndFrame(); return true; }