This commit is contained in:
Dander7BD 2014-02-17 11:27:43 +01:00
parent 7395a0a495
commit aa2518a4f6
22 changed files with 182 additions and 109 deletions

View File

@ -18,12 +18,15 @@
#include "WinTimer.h" #include "WinTimer.h"
#include "vld.h" #include "vld.h"
#include "EventHandler/EventHandler.h" #include "../Misc/EventHandler/EventHandler.h"
#include "GameClientState\SharedStateContent.h"
using namespace ::Oyster; using namespace ::Oyster;
using namespace ::Oyster::Event; using namespace ::Oyster::Event;
using namespace ::Oyster::Network; using namespace ::Oyster::Network;
using namespace ::Utility::DynamicMemory; using namespace ::Utility::DynamicMemory;
using namespace ::DanBias::Client;
void ClientEventFunction( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e ); void ClientEventFunction( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e );
@ -32,15 +35,17 @@ namespace DanBias
#pragma region Game Data #pragma region Game Data
class DanBiasGamePrivateData class DanBiasGamePrivateData
{ {
public: public:
WindowShell* window; WindowShell* window;
InputClass* inputObj; InputClass inputObj;
Utility::WinTimer timer; Utility::WinTimer timer;
UniquePointer<Client::GameClientState> state;
NetworkClient networkClient;
bool serverOwner;
UniquePointer<Client::GameClientState> state;
SharedStateContent sharedStateContent;
NetworkClient networkClient;
bool serverOwner;
float capFrame; float capFrame;
DanBiasGamePrivateData() DanBiasGamePrivateData()
@ -72,10 +77,13 @@ namespace DanBias
data.networkClient.SetMessagePump( ClientEventFunction ); data.networkClient.SetMessagePump( ClientEventFunction );
data.sharedStateContent.network = &data.networkClient;
data.sharedStateContent.input = &data.inputObj;
// Start in main menu state // Start in main menu state
data.state = new Client::MainState(); data.state = new Client::MainState();
if( !data.state->Init( &data.networkClient ) ) if( !data.state->Init( data.sharedStateContent ) )
return DanBiasClientReturn_Error; return DanBiasClientReturn_Error;
data.timer.reset(); data.timer.reset();
@ -140,8 +148,7 @@ namespace DanBias
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitInput() HRESULT DanBiasGame::InitInput()
{ {
data.inputObj = new InputClass; if(!data.inputObj.Initialize(data.window->GetHINSTANCE(), data.window->GetHWND(), data.window->GetHeight(), data.window->GetWidth()))
if(!data.inputObj->Initialize(data.window->GetHINSTANCE(), data.window->GetHWND(), data.window->GetHeight(), data.window->GetWidth()))
{ {
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK); MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
return E_FAIL; return E_FAIL;
@ -164,7 +171,7 @@ namespace DanBias
float mouseNormalisedY = (float)(mousePos.y - windowVertex.top); float mouseNormalisedY = (float)(mousePos.y - windowVertex.top);
mouseNormalisedY /= (float)(windowVertex.bottom - windowVertex.top); mouseNormalisedY /= (float)(windowVertex.bottom - windowVertex.top);
data.inputObj->Update( mouseNormalisedX, mouseNormalisedY ); data.inputObj.Update( mouseNormalisedX, mouseNormalisedY );
} }
if( data.serverOwner ) if( data.serverOwner )
@ -174,7 +181,7 @@ namespace DanBias
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same; DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
state = data.state->Update( deltaTime, data.inputObj ); state = data.state->Update( deltaTime );
if( state != Client::GameClientState::ClientState_Same ) if( state != Client::GameClientState::ClientState_Same )
{ {
@ -217,7 +224,7 @@ namespace DanBias
if( stateChanged ) if( stateChanged )
{ {
data.state->Init( &data.networkClient ); // send game client data.state->Init( data.sharedStateContent ); // send game client
} }
} }
return Result_continue; return Result_continue;
@ -235,8 +242,6 @@ namespace DanBias
if( data.networkClient.IsConnected() ) if( data.networkClient.IsConnected() )
data.networkClient.Disconnect(); data.networkClient.Disconnect();
delete data.inputObj;
data.state = nullptr; data.state = nullptr;
EventHandler::Instance().Clean(); EventHandler::Instance().Clean();
Graphics::API::Clean(); Graphics::API::Clean();

View File

@ -5,8 +5,8 @@
#ifndef DANBIAS_CLIENT_EVENT_BUTTON_GUI_H #ifndef DANBIAS_CLIENT_EVENT_BUTTON_GUI_H
#define DANBIAS_CLIENT_EVENT_BUTTON_GUI_H #define DANBIAS_CLIENT_EVENT_BUTTON_GUI_H
#include "EventHandler/EventButton.h" #include "../Misc/EventHandler/EventButton.h"
#include "DllInterfaces/GFXAPI.h" #include "../OysterGraphics/DllInterfaces/GFXAPI.h"

View File

@ -100,5 +100,9 @@ void C_Object::Render()
} }
void C_Object::Release() void C_Object::Release()
{ {
Oyster::Graphics::API::DeleteModel(model); if( this->model )
{
Oyster::Graphics::API::DeleteModel(model);
this->model = nullptr;
}
} }

View File

@ -16,37 +16,55 @@ namespace DanBias
bool visible; bool visible;
}; };
class C_Object class C_Object
{
private:
Oyster::Math::Float4x4 world;
Oyster::Math::Float3 position;
Oyster::Math::Quaternion rotation;
Oyster::Math::Float3 scale;
int id;
void updateWorld();
protected:
Oyster::Graphics::Model::Model *model;
public:
C_Object();
virtual ~C_Object();
virtual bool Init(ModelInitData modelInit);
void setWorld(Oyster::Math::Float4x4 world);
Oyster::Math::Float4x4 getWorld() const;
void setPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getPos() const;
void addPos(Oyster::Math::Float3 deltaPos);
void setRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRotation() const;
void addRot(Oyster::Math::Quaternion deltaRot);
void setScale(Oyster::Math::Float3 newScale);
void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const;
virtual void Render();
virtual void Release();
virtual int GetId() const;
};
}
}
#include "Utilities.h"
namespace Utility { namespace DynamicMemory
{ {
private: template<>
Oyster::Math::Float4x4 world; inline void SafeDeleteInstance( ::DanBias::Client::C_Object *dynamicInstance )
Oyster::Math::Float3 position; {
Oyster::Math::Quaternion rotation; if( dynamicInstance )
Oyster::Math::Float3 scale; {
dynamicInstance->Release();
delete dynamicInstance;
}
}
} }
int id;
void updateWorld();
protected:
Oyster::Graphics::Model::Model *model;
public:
C_Object();
virtual ~C_Object();
virtual bool Init(ModelInitData modelInit);
void setWorld(Oyster::Math::Float4x4 world);
Oyster::Math::Float4x4 getWorld() const;
void setPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getPos() const;
void addPos(Oyster::Math::Float3 deltaPos);
void setRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRotation() const;
void addRot(Oyster::Math::Quaternion deltaRot);
void setScale(Oyster::Math::Float3 newScale);
void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const;
virtual void Render();
virtual void Release();
virtual int GetId() const;
};};};
#endif #endif

View File

@ -3,9 +3,9 @@
using namespace DanBias::Client; using namespace DanBias::Client;
using namespace ::Oyster::Network; using namespace ::Oyster::Network;
GameClientState::GameClientState(void) {} GameClientState::GameClientState() {}
GameClientState::~GameClientState(void) {} GameClientState::~GameClientState() {}
void GameClientState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e ) void GameClientState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
{ /* do nothing */ } { /* do nothing */ }

View File

@ -2,8 +2,7 @@
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H #define DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define NOMINMAX #define NOMINMAX
#include "L_inputClass.h" #include "SharedStateContent.h"
#include "NetworkClient.h"
namespace DanBias { namespace Client namespace DanBias { namespace Client
{ {
@ -24,10 +23,10 @@ namespace DanBias { namespace Client
}; };
public: public:
GameClientState(void); GameClientState();
virtual ~GameClientState(void); virtual ~GameClientState();
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0; virtual bool Init( SharedStateContent &shared ) = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0; virtual ClientState Update( float deltaTime ) = 0;
virtual bool Render() = 0; virtual bool Render() = 0;
virtual bool Release() = 0; virtual bool Release() = 0;
virtual void ChangeState( ClientState next ) = 0; virtual void ChangeState( ClientState next ) = 0;

View File

@ -15,9 +15,10 @@ struct GameState::MyData
MyData(){} MyData(){}
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
InputClass *input;
} privData; } privData;
GameState::GameState(void) GameState::GameState()
{ {
key_forward = false; key_forward = false;
key_backward = false; key_backward = false;
@ -25,24 +26,25 @@ GameState::GameState(void)
key_strafeLeft = false; key_strafeLeft = false;
} }
GameState::~GameState(void) GameState::~GameState()
{ {
if( this->privData ) if( this->privData )
this->Release(); this->Release();
} }
bool GameState::Init(NetworkClient* nwClient) bool GameState::Init( SharedStateContent &shared )
{ {
// load models // load models
privData = new MyData(); privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->input = shared.input;
LoadGame(); LoadGame();
//tell server ready //tell server ready
nwClient->Send( GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready) ); this->privData->nwClient->Send( GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready) );
return true; return true;
} }
@ -180,7 +182,7 @@ void GameState::InitiatePlayer(int id, std::wstring modelName, Float4x4 world)
camera.UpdateOrientation(); camera.UpdateOrientation();
} }
GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState GameState::Update( float deltaTime )
{ {
//switch (privData->state) //switch (privData->state)
//{ //{

View File

@ -25,8 +25,8 @@ namespace DanBias { namespace Client
GameState(void); GameState(void);
~GameState(void); ~GameState(void);
bool Init(Oyster::Network::NetworkClient* nwClient); bool Init( SharedStateContent &shared );
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override; GameClientState::ClientState Update( float deltaTime ) override;
bool LoadModels(std::string mapFile); bool LoadModels(std::string mapFile);
bool InitCamera(Oyster::Math::Float3 startPos) ; bool InitCamera(Oyster::Math::Float3 startPos) ;

View File

@ -28,6 +28,7 @@ struct LanMenuState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
InputClass *input;
Graphics::API::Texture background; Graphics::API::Texture background;
EventButtonCollection guiElements; EventButtonCollection guiElements;
@ -46,12 +47,13 @@ LanMenuState::~LanMenuState()
this->Release(); this->Release();
} }
bool LanMenuState::Init(Network::NetworkClient* nwClient) bool LanMenuState::Init( SharedStateContent &shared )
{ {
this->privData = new MyData(); this->privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->input = shared.input;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
@ -80,12 +82,12 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient)
return true; return true;
} }
GameClientState::ClientState LanMenuState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState LanMenuState::Update( float deltaTime )
{ {
MouseInput mouseState; MouseInput mouseState;
{ {
KeyInput->GetMousePos( mouseState.x, mouseState.y ); this->privData->input->GetMousePos( mouseState.x, mouseState.y );
mouseState.mouseButtonPressed = KeyInput->IsMousePressed(); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
} }
EventHandler::Instance().Update( mouseState ); EventHandler::Instance().Update( mouseState );

View File

@ -14,8 +14,8 @@ namespace DanBias
LanMenuState(); LanMenuState();
virtual ~LanMenuState(); virtual ~LanMenuState();
virtual bool Init(Oyster::Network::NetworkClient* nwClient); bool Init( SharedStateContent &shared );
virtual ClientState Update(float deltaTime, InputClass* KeyInput); virtual ClientState Update( float deltaTime );
virtual bool Render(); virtual bool Render();
virtual bool Release(); virtual bool Release();

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "Utilities.h" #include "../Misc/Utilities.h"
#include "ObjectDefines.h" #include "ObjectDefines.h"
namespace GameLogic namespace GameLogic

View File

@ -4,7 +4,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "ObjectDefines.h" #include "ObjectDefines.h"
#include "Utilities.h" #include "../Misc/Utilities.h"
namespace GameLogic namespace GameLogic
{ {

View File

@ -5,7 +5,7 @@
#ifndef LOADER_H #ifndef LOADER_H
#define LOADER_H #define LOADER_H
#include "Resource\OysterResource.h" #include "..\Misc\Resource\OysterResource.h"
#include <string> #include <string>
namespace GameLogic namespace GameLogic

View File

@ -22,6 +22,7 @@ struct LobbyAdminState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
InputClass *input;
Graphics::API::Texture background; Graphics::API::Texture background;
EventButtonCollection guiElements; EventButtonCollection guiElements;
} privData; } privData;
@ -36,12 +37,13 @@ LobbyAdminState::~LobbyAdminState(void)
this->Release(); this->Release();
} }
bool LobbyAdminState::Init(NetworkClient* nwClient) bool LobbyAdminState::Init( SharedStateContent &shared )
{ {
privData = new MyData(); privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->input = shared.input;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
@ -57,7 +59,7 @@ bool LobbyAdminState::Init(NetworkClient* nwClient)
return true; return true;
} }
GameClientState::ClientState LobbyAdminState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState LobbyAdminState::Update( float deltaTime )
{ {
// Wishlist: // Wishlist:
// picking // picking
@ -70,8 +72,8 @@ GameClientState::ClientState LobbyAdminState::Update(float deltaTime, InputClass
MouseInput mouseState; MouseInput mouseState;
{ {
KeyInput->GetMousePos( mouseState.x, mouseState.y ); this->privData->input->GetMousePos( mouseState.x, mouseState.y );
mouseState.mouseButtonPressed = KeyInput->IsMousePressed(); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
} }
EventHandler::Instance().Update( mouseState ); EventHandler::Instance().Update( mouseState );

View File

@ -24,8 +24,8 @@ namespace DanBias
LobbyAdminState(); LobbyAdminState();
~LobbyAdminState(); ~LobbyAdminState();
bool Init( Oyster::Network::NetworkClient* nwClient ); bool Init( SharedStateContent &shared );
ClientState Update( float deltaTime, InputClass* KeyInput ); ClientState Update( float deltaTime );
bool Render(); bool Render();
bool Release(); bool Release();
void ChangeState( ClientState next ); void ChangeState( ClientState next );

View File

@ -22,6 +22,7 @@ struct LobbyState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
InputClass *input;
Graphics::API::Texture background; Graphics::API::Texture background;
EventButtonCollection guiElements; EventButtonCollection guiElements;
} privData; } privData;
@ -36,12 +37,13 @@ LobbyState::~LobbyState(void)
this->Release(); this->Release();
} }
bool LobbyState::Init(NetworkClient* nwClient) bool LobbyState::Init( SharedStateContent &shared )
{ {
privData = new MyData(); privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->input = shared.input;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
@ -57,7 +59,7 @@ bool LobbyState::Init(NetworkClient* nwClient)
return true; return true;
} }
GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState LobbyState::Update( float deltaTime )
{ {
// Wishlist: // Wishlist:
// picking // picking
@ -70,8 +72,8 @@ GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* Key
MouseInput mouseState; MouseInput mouseState;
{ {
KeyInput->GetMousePos( mouseState.x, mouseState.y ); this->privData->input->GetMousePos( mouseState.x, mouseState.y );
mouseState.mouseButtonPressed = KeyInput->IsMousePressed(); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
} }
EventHandler::Instance().Update( mouseState ); EventHandler::Instance().Update( mouseState );

View File

@ -23,11 +23,11 @@ namespace DanBias
class LobbyState : public GameClientState class LobbyState : public GameClientState
{ {
public: public:
LobbyState(void); LobbyState();
~LobbyState(void); ~LobbyState();
bool Init( Oyster::Network::NetworkClient* nwClient ); bool Init( SharedStateContent &shared );
ClientState Update( float deltaTime, InputClass* KeyInput ); ClientState Update( float deltaTime );
bool Render(); bool Render();
bool Release(); bool Release();
void ChangeState( ClientState next ); void ChangeState( ClientState next );

View File

@ -24,6 +24,7 @@ struct MainState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
InputClass *input;
Graphics::API::Texture background; Graphics::API::Texture background;
EventButtonCollection guiElements; EventButtonCollection guiElements;
}; };
@ -32,20 +33,21 @@ void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e ); void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e ); void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e );
MainState::MainState(void) {} MainState::MainState() {}
MainState::~MainState(void) MainState::~MainState()
{ {
if( this->privData ) if( this->privData )
this->Release(); this->Release();
} }
bool MainState::Init( NetworkClient* nwClient ) bool MainState::Init( SharedStateContent &shared )
{ {
this->privData = new MyData(); this->privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->input = shared.input;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
@ -67,12 +69,12 @@ bool MainState::Init( NetworkClient* nwClient )
return true; return true;
} }
GameClientState::ClientState MainState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState MainState::Update( float deltaTime )
{ {
MouseInput mouseState; MouseInput mouseState;
{ {
KeyInput->GetMousePos( mouseState.x, mouseState.y ); this->privData->input->GetMousePos( mouseState.x, mouseState.y );
mouseState.mouseButtonPressed = KeyInput->IsMousePressed(); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
} }
EventHandler::Instance().Update( mouseState ); EventHandler::Instance().Update( mouseState );

View File

@ -11,18 +11,18 @@ namespace DanBias
{ {
class MainState : public GameClientState class MainState : public GameClientState
{ {
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
public: public:
MainState(void); MainState();
~MainState(void); ~MainState();
bool Init( Oyster::Network::NetworkClient* nwClient ); bool Init( SharedStateContent &shared );
ClientState Update(float deltaTime, InputClass* KeyInput); ClientState Update( float deltaTime );
bool Render(); bool Render();
bool Release(); bool Release();
void ChangeState( ClientState next ); void ChangeState( ClientState next );
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
}; };
} }
} }

View File

@ -13,6 +13,7 @@ struct NetLoadState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
Graphics::API::Texture background;
bool loading; bool loading;
}; };
@ -24,28 +25,36 @@ NetLoadState::~NetLoadState(void)
this->Release(); this->Release();
} }
bool NetLoadState::Init( NetworkClient* nwClient ) bool NetLoadState::Init( SharedStateContent &shared )
{ {
this->privData = new MyData(); this->privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient; this->privData->nwClient = shared.network;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
this->privData->loading = false; this->privData->loading = false;
// we may assume that nwClient is properly connected to the server // we may assume that nwClient is properly connected to the server
// signals querry to server for loading instructions // signals querry to server for loading instructions
nwClient->Send( Protocol_QuerryGameType() ); this->privData->nwClient->Send( Protocol_QuerryGameType() );
return true; return true;
} }
GameClientState::ClientState NetLoadState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState NetLoadState::Update( float deltaTime )
{ {
return this->privData->nextState; return this->privData->nextState;
} }
bool NetLoadState::Render() bool NetLoadState::Render()
{ {
Graphics::API::NewFrame();
Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) );
Graphics::API::EndFrame();
return true; return true;
} }

View File

@ -14,8 +14,8 @@ namespace DanBias
NetLoadState( ); NetLoadState( );
virtual ~NetLoadState( ); virtual ~NetLoadState( );
bool Init( Oyster::Network::NetworkClient* nwClient ); bool Init( SharedStateContent &shared );
ClientState Update( float deltaTime, InputClass* KeyInput ); ClientState Update( float deltaTime );
bool Render(); bool Render();
bool Release(); bool Release();

View File

@ -0,0 +1,28 @@
/********************************************************************
* Created by Dan Andersson, 2014
* Contains a shared memory struct.
* Whihc reference passed seamlessly between the game states
* at their Init calls.
********************************************************************/
#ifndef SHAREDSTATECONTENT_H
#define SHAREDSTATECONTENT_H
#include <map>
#include "Utilities.h"
#include "C_Object.h"
#include "NetworkClient.h"
#include "L_inputClass.h"
namespace DanBias { namespace Client
{
struct SharedStateContent
{
public:
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_Object>> scene;
::Oyster::Network::NetworkClient *network;
InputClass* input;
};
} }
#endif