Bugs and Compilation errors dealt with
This commit is contained in:
parent
d7102fe7e6
commit
5ff8661843
|
@ -87,6 +87,8 @@ namespace DanBias
|
|||
float dt = (float)data.timer.getElapsedSeconds();
|
||||
data.timer.reset();
|
||||
|
||||
::Oyster::Graphics::API::Update( dt );
|
||||
|
||||
if(data.networkClient.IsConnected())
|
||||
data.networkClient.Update();
|
||||
|
||||
|
@ -95,7 +97,7 @@ namespace DanBias
|
|||
{
|
||||
if(Update(dt) != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
if(Render(dt) != S_OK)
|
||||
if(Render() != S_OK)
|
||||
return DanBiasClientReturn_Error;
|
||||
data.capFrame = 0;
|
||||
}
|
||||
|
@ -185,7 +187,7 @@ namespace DanBias
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT DanBiasGame::Render(float deltaTime)
|
||||
HRESULT DanBiasGame::Render( )
|
||||
{
|
||||
data.state->Render();
|
||||
|
||||
|
|
|
@ -17,12 +17,14 @@ namespace DanBias
|
|||
|
||||
class C_Object
|
||||
{
|
||||
protected:
|
||||
Oyster::Graphics::Model::Model *model;
|
||||
private:
|
||||
Oyster::Math::Float4x4 world;
|
||||
Oyster::Math::Float3 position;
|
||||
Oyster::Math::Quaternion rotation;
|
||||
Oyster::Math::Float3 scale;
|
||||
Oyster::Graphics::Model::Model *model;
|
||||
|
||||
int id;
|
||||
void updateWorld();
|
||||
public:
|
||||
|
|
|
@ -3,19 +3,14 @@
|
|||
using namespace DanBias::Client;
|
||||
|
||||
C_Player::C_Player(void)
|
||||
:C_DynamicObj()
|
||||
{
|
||||
:C_DynamicObj() {}
|
||||
|
||||
}
|
||||
|
||||
C_Player::~C_Player(void)
|
||||
{
|
||||
|
||||
}
|
||||
C_Player::~C_Player(void) {}
|
||||
|
||||
void C_Player::Init(ModelInitData modelInit)
|
||||
{
|
||||
C_Object::Init(modelInit);
|
||||
Oyster::Graphics::API::PlayAnimation(model, L"movement");
|
||||
|
||||
Oyster::Graphics::API::PlayAnimation( this->model, L"movement" );
|
||||
//Oyster::Graphics::API::Update(0.002f);
|
||||
}
|
||||
|
|
|
@ -13,5 +13,7 @@ public:
|
|||
virtual ~C_Player(void);
|
||||
void Init(ModelInitData modelInit);
|
||||
|
||||
};};};
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -11,5 +11,5 @@ GameClientState::~GameClientState(void)
|
|||
{
|
||||
}
|
||||
|
||||
void DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
|
||||
void GameClientState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
|
||||
{ /* do nothing */ }
|
|
@ -409,10 +409,6 @@ void GameState::readKeyInput(InputClass* KeyInput)
|
|||
|
||||
GameLogic::Protocol_PlayerLook playerLookDir;
|
||||
Float4 look = camera.GetLook();
|
||||
playerLookDir.lookDirX = look.x;
|
||||
playerLookDir.lookDirY = look.y;
|
||||
playerLookDir.lookDirZ = look.z;
|
||||
playerLookDir.deltaX = -KeyInput->GetYaw();
|
||||
|
||||
privData->nwClient->Send( playerLookDir );
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ GameClientState::ClientState LanMenuState::ChangeState(InputClass* KeyInput)
|
|||
return ClientState_Same;
|
||||
}
|
||||
|
||||
bool LanMenuState::Render(float dt)
|
||||
bool LanMenuState::Render( )
|
||||
{
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace DanBias
|
|||
bool LoadModels(std::wstring file);
|
||||
bool InitCamera(Oyster::Math::Float3 startPos);
|
||||
|
||||
virtual bool Render(float dt);
|
||||
virtual bool Render();
|
||||
virtual bool Release();
|
||||
|
||||
private:
|
||||
|
|
|
@ -98,9 +98,8 @@ GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* Key
|
|||
|
||||
return ClientState_Same;
|
||||
}
|
||||
bool LobbyState::Render(float dt)
|
||||
bool LobbyState::Render( )
|
||||
{
|
||||
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
|
||||
|
|
|
@ -7,10 +7,15 @@
|
|||
#include <GameServerAPI.h>
|
||||
#include "NetworkClient.h"
|
||||
|
||||
#include "EventHandler\EventHandler.h"
|
||||
#include "Buttons\ButtonRectangle.h"
|
||||
|
||||
using namespace ::DanBias::Client;
|
||||
using namespace ::Oyster::Math3D;
|
||||
using namespace ::Oyster::Network;
|
||||
using namespace ::Utility::DynamicMemory;
|
||||
using namespace ::Utility::StaticArray;
|
||||
using namespace ::Oyster::Event;
|
||||
|
||||
struct MainState::MyData
|
||||
{
|
||||
|
@ -20,10 +25,12 @@ struct MainState::MyData
|
|||
Float4x4 proj;
|
||||
|
||||
UniquePointer<C_Object> object[2];
|
||||
int modelCount;
|
||||
NetworkClient *nwClient;
|
||||
EventButtonCollection button;
|
||||
};
|
||||
|
||||
void OnButtonInteract( Oyster::Event::ButtonEvent<GameClientState*>& e );
|
||||
|
||||
MainState::MainState(void) {}
|
||||
|
||||
MainState::~MainState(void) {}
|
||||
|
@ -32,6 +39,13 @@ bool MainState::Init( NetworkClient* nwClient )
|
|||
{
|
||||
this->privData = new MyData();
|
||||
|
||||
// create buttons
|
||||
ButtonRectangle<GameClientState*> *button = new ButtonRectangle<GameClientState*>( L"box_tex.png", OnButtonInteract, this, 0.5f, 0.5f, 0.1f, 0.1f, true );
|
||||
this->privData->button.AddButton( button );
|
||||
|
||||
// bind button collection to the singleton eventhandler
|
||||
EventHandler::Instance().AddCollection( &this->privData->button );
|
||||
|
||||
// load models
|
||||
LoadModels(L"UImodels.txt");
|
||||
InitCamera( Float3(0.0f, 0.0f, 5.4f) );
|
||||
|
@ -49,7 +63,6 @@ bool MainState::LoadModels(std::wstring file)
|
|||
// open file
|
||||
// read file
|
||||
// init models
|
||||
privData->modelCount = 2;
|
||||
|
||||
ModelInitData modelData;
|
||||
|
||||
|
@ -126,16 +139,19 @@ GameClientState::ClientState MainState::Update(float deltaTime, InputClass* KeyI
|
|||
|
||||
bool MainState::Render()
|
||||
{
|
||||
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
|
||||
Oyster::Graphics::API::NewFrame();
|
||||
// render objects
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
{
|
||||
privData->object[i]->Render();
|
||||
}
|
||||
//for (int i = 0; i < NumElementsOf(privData->object); i++)
|
||||
//{
|
||||
// privData->object[i]->Render();
|
||||
//}
|
||||
|
||||
Oyster::Graphics::API::StartGuiRender();
|
||||
this->privData->button.Render();
|
||||
|
||||
|
||||
// render effects
|
||||
|
||||
|
@ -147,15 +163,19 @@ bool MainState::Render()
|
|||
|
||||
bool MainState::Release()
|
||||
{
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
for (int i = 0; i < NumElementsOf(privData->object); i++)
|
||||
{
|
||||
privData->object[i]->Release();
|
||||
delete privData->object[i];
|
||||
privData->object[i] = NULL;
|
||||
}
|
||||
|
||||
delete privData;
|
||||
privData = NULL;
|
||||
// button collection will be autoreleased from EventHandler
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// button actions
|
||||
void OnButtonInteract( Oyster::Event::ButtonEvent<GameClientState*>& e )
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ namespace DanBias
|
|||
|
||||
bool Render();
|
||||
bool Release();
|
||||
|
||||
void DataRecieved( ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> e );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace DanBias
|
|||
static HRESULT InitInput();
|
||||
|
||||
static HRESULT Update(float deltaTime);
|
||||
static HRESULT Render(float deltaTime);
|
||||
static HRESULT Render();
|
||||
static HRESULT CleanUp();
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ struct NetworkClient::PrivateData : public IThreadObject
|
|||
{
|
||||
NetworkSession *owner;
|
||||
NetworkClient *parent;
|
||||
ClientEventFunction OnRecieve;
|
||||
Connection connection;
|
||||
Translator translator;
|
||||
OysterThread thread;
|
||||
|
@ -57,7 +56,6 @@ struct NetworkClient::PrivateData : public IThreadObject
|
|||
: ID(currID++)
|
||||
, parent(0)
|
||||
, owner(0)
|
||||
, OnRecieve(OnRecieve_Default)
|
||||
{
|
||||
InitWinSock();
|
||||
this->thread.Create(this, false);
|
||||
|
@ -226,7 +224,8 @@ unsigned int NetworkClient::PrivateData::currID = 0;
|
|||
*************************************/
|
||||
|
||||
NetworkClient::NetworkClient()
|
||||
: privateData(0)
|
||||
: privateData(nullptr),
|
||||
OnRecieve(OnRecieve_Default)
|
||||
{ }
|
||||
|
||||
NetworkClient::~NetworkClient()
|
||||
|
@ -326,11 +325,11 @@ void NetworkClient::SetMessagePump( NetworkClient::ClientEventFunction func )
|
|||
{
|
||||
if( func )
|
||||
{
|
||||
this->privateData->OnRecieve = func;
|
||||
this->OnRecieve = func;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->privateData->OnRecieve = OnRecieve_Default;
|
||||
this->OnRecieve = OnRecieve_Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +352,7 @@ void NetworkClient::DataRecieved(NetEvent<NetworkClient*, ClientEventArgs> e)
|
|||
}
|
||||
else
|
||||
{
|
||||
this->privateData->OnRecieve( e );
|
||||
this->OnRecieve( e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ namespace Oyster
|
|||
NetworkClient(const NetworkClient& obj);
|
||||
NetworkClient& operator =(const NetworkClient& obj);
|
||||
|
||||
ClientEventFunction OnRecieve;
|
||||
struct PrivateData;
|
||||
PrivateData* privateData;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue