GUI - GUI testing.

This commit is contained in:
Pontus Fransson 2014-02-11 15:06:46 +01:00
parent a99a9b3e2e
commit 1725f05c4b
2 changed files with 25 additions and 11 deletions

View File

@ -47,10 +47,13 @@ namespace DanBias
} }
virtual void Render() virtual void Render()
{
if(EventButton<Owner>::Enabled())
{ {
//Render att xPos and yPos //Render att xPos and yPos
//With halfWidth and halfHeight //With halfWidth and halfHeight
} }
}
protected: protected:
float xPos, yPos; float xPos, yPos;

View File

@ -8,6 +8,12 @@
using namespace DanBias::Client; 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 struct LoginState::myData
{ {
myData(){} myData(){}
@ -17,12 +23,12 @@ struct LoginState::myData
int modelCount; int modelCount;
// UI object // UI object
// game client* // game client*
//Menu button collection
EventButtonCollection* collection;
}privData; }privData;
#include "Buttons\ButtonCircle.h"
#include "Buttons\ButtonRectangle.h"
#include "../Misc/EventHandler/EventHandler.h"
using namespace Oyster::Event;
enum TestEnum enum TestEnum
{ {
@ -33,10 +39,6 @@ enum TestEnum
LoginState::LoginState(void) LoginState::LoginState(void)
{ {
EventButtonCollection* collection = new EventButtonCollection;
EventHandler::Instance().AddCollection(collection);
collection->AddButton(new ButtonRectangle<LoginState*>(L"textureName.jpg", &LoginState::ButtonCallback, this, (void*)Options, 0.0f, 0.0f, 0.0f, 0.0f));
} }
void LoginState::ButtonCallback(Oyster::Event::ButtonEvent<LoginState*>& e) void LoginState::ButtonCallback(Oyster::Event::ButtonEvent<LoginState*>& e)
@ -68,8 +70,14 @@ bool LoginState::Init(Oyster::Network::NetworkClient* nwClient)
privData = new myData(); privData = new myData();
this->nwClient = nwClient; this->nwClient = nwClient;
// load models // load models
LoadModels(L"UImodels.txt"); //LoadModels(L"UImodels.txt");
InitCamera(Oyster::Math::Float3(0,0,5.4f)); 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<LoginState*>(L"textureName.jpg", &LoginState::ButtonCallback, this, (void*)Options, 0.0f, 0.0f, 0.0f, 0.0f));
return true; return true;
} }
bool LoginState::LoadModels(std::wstring file) bool LoginState::LoadModels(std::wstring file)
@ -172,6 +180,9 @@ bool LoginState::Render()
// render lights // render lights
//Render buttons
EventHandler::Instance().Render();
Oyster::Graphics::API::EndFrame(); Oyster::Graphics::API::EndFrame();
return true; return true;
} }