2013-12-06 10:38:43 +01:00
|
|
|
#include "LobbyState.h"
|
|
|
|
#include "DllInterfaces/GFXAPI.h"
|
|
|
|
#include "OysterMath.h"
|
|
|
|
using namespace DanBias::Client;
|
|
|
|
|
2013-12-09 09:23:39 +01:00
|
|
|
struct LobbyState::myData
|
2013-12-06 10:38:43 +01:00
|
|
|
{
|
2013-12-09 09:23:39 +01:00
|
|
|
myData(){}
|
2013-12-06 10:38:43 +01:00
|
|
|
Oyster::Math3D::Float4x4 view;
|
|
|
|
Oyster::Math3D::Float4x4 proj;
|
|
|
|
Oyster::Graphics::Model::Model *model;
|
2013-12-09 09:23:39 +01:00
|
|
|
}privData;
|
2013-12-06 10:38:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
LobbyState::LobbyState(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LobbyState::~LobbyState(void)
|
|
|
|
{
|
2013-12-09 09:23:39 +01:00
|
|
|
Oyster::Graphics::API::DeleteModel(privData->model);
|
|
|
|
Oyster::Graphics::API::Clean();
|
2013-12-06 10:38:43 +01:00
|
|
|
}
|
|
|
|
bool LobbyState::Init()
|
|
|
|
{
|
2013-12-09 09:23:39 +01:00
|
|
|
// load models
|
|
|
|
privData = new myData();
|
|
|
|
privData->model = Oyster::Graphics::API::CreateModel(L"crate");
|
|
|
|
|
|
|
|
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
|
|
|
|
//privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000);
|
|
|
|
Oyster::Graphics::API::SetProjection(privData->proj);
|
|
|
|
|
|
|
|
privData->view = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f));
|
|
|
|
privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view);
|
|
|
|
|
|
|
|
|
2013-12-06 10:38:43 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2013-12-09 09:23:39 +01:00
|
|
|
GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* KeyInput)
|
2013-12-06 10:38:43 +01:00
|
|
|
{
|
|
|
|
|
2013-12-09 09:23:39 +01:00
|
|
|
if( KeyInput->IsKeyPressed(DIK_Q))
|
|
|
|
return ClientState_Game;
|
2013-12-06 10:38:43 +01:00
|
|
|
return ClientState_Same;
|
|
|
|
}
|
|
|
|
bool LobbyState::Render()
|
|
|
|
{
|
2013-12-09 09:23:39 +01:00
|
|
|
|
|
|
|
Oyster::Graphics::API::SetView(privData->view);
|
|
|
|
Oyster::Graphics::API::SetProjection( privData->proj);
|
|
|
|
Oyster::Graphics::API::NewFrame();
|
|
|
|
Oyster::Graphics::API::RenderModel(*(privData->model));
|
2013-12-06 10:38:43 +01:00
|
|
|
Oyster::Graphics::API::EndFrame();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool LobbyState::Release()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|