GL - added UI object
This commit is contained in:
parent
4134836405
commit
ea593743ad
|
@ -189,6 +189,7 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="GameClientState\GameState\C_UIobject.cpp" />
|
||||||
<ClCompile Include="DanBiasGame_Impl.cpp" />
|
<ClCompile Include="DanBiasGame_Impl.cpp" />
|
||||||
<ClCompile Include="DLLMain.cpp" />
|
<ClCompile Include="DLLMain.cpp" />
|
||||||
<ClCompile Include="GameClientState\GameState\C_DynamicObj.cpp" />
|
<ClCompile Include="GameClientState\GameState\C_DynamicObj.cpp" />
|
||||||
|
@ -200,6 +201,7 @@
|
||||||
<ClCompile Include="GameClientState\C_Object.cpp" />
|
<ClCompile Include="GameClientState\C_Object.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="GameClientState\GameState\C_UIobject.h" />
|
||||||
<ClInclude Include="GameClientState\GameState\C_DynamicObj.h" />
|
<ClInclude Include="GameClientState\GameState\C_DynamicObj.h" />
|
||||||
<ClInclude Include="GameClientState\GameClientState.h" />
|
<ClInclude Include="GameClientState\GameClientState.h" />
|
||||||
<ClInclude Include="GameClientState\GameState.h" />
|
<ClInclude Include="GameClientState\GameState.h" />
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
namespace Client
|
namespace Client
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct ModelInitData
|
||||||
|
{
|
||||||
|
std::wstring modelPath;
|
||||||
|
Oyster::Math::Float4x4 world;
|
||||||
|
bool visible;
|
||||||
|
};
|
||||||
|
|
||||||
class C_Object
|
class C_Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Init() = 0;
|
virtual void Init(ModelInitData modelInit) = 0;
|
||||||
virtual void setPos() = 0;
|
virtual void setPos() = 0;
|
||||||
|
|
||||||
virtual void Render() = 0;
|
virtual void Render() = 0;
|
||||||
|
|
|
@ -22,10 +22,15 @@ GameState::~GameState(void)
|
||||||
}
|
}
|
||||||
bool GameState::Init()
|
bool GameState::Init()
|
||||||
{
|
{
|
||||||
|
ModelInitData modelData;
|
||||||
|
|
||||||
|
modelData.world = Oyster::Math3D::Float4x4::identity;
|
||||||
|
modelData.visible = true;
|
||||||
|
modelData.modelPath = L"worldDummy";
|
||||||
// load models
|
// load models
|
||||||
privData = new myData();
|
privData = new myData();
|
||||||
privData->player = new C_Player;
|
privData->player = new C_Player;
|
||||||
privData->player->Init();
|
privData->player->Init(modelData);
|
||||||
|
|
||||||
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
|
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
|
||||||
Oyster::Graphics::API::SetProjection(privData->proj);
|
Oyster::Graphics::API::SetProjection(privData->proj);
|
||||||
|
|
|
@ -18,11 +18,13 @@ C_DynamicObj::~C_DynamicObj(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
void C_DynamicObj::Init()
|
void C_DynamicObj::Init(ModelInitData modelInit)
|
||||||
{
|
{
|
||||||
// load models
|
// load models
|
||||||
privData = new myData();
|
privData = new myData();
|
||||||
privData->model = Oyster::Graphics::API::CreateModel(L"crate");
|
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
|
||||||
|
privData->model->WorldMatrix = modelInit.world;
|
||||||
|
privData->model->Visible = modelInit.visible;
|
||||||
}
|
}
|
||||||
void C_DynamicObj::setPos()
|
void C_DynamicObj::setPos()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "../C_Object.h"
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
namespace Client
|
namespace Client
|
||||||
{
|
{
|
||||||
class C_DynamicObj
|
class C_DynamicObj : private C_Object
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct myData;
|
struct myData;
|
||||||
|
@ -11,7 +12,7 @@ private:
|
||||||
public:
|
public:
|
||||||
C_DynamicObj(void);
|
C_DynamicObj(void);
|
||||||
virtual ~C_DynamicObj(void);
|
virtual ~C_DynamicObj(void);
|
||||||
void Init();
|
void Init(ModelInitData modelInit);
|
||||||
void setPos();
|
void setPos();
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
|
|
|
@ -20,11 +20,15 @@ C_Player::~C_Player(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_Player::Init()
|
void C_Player::Init(ModelInitData modelInit)
|
||||||
{
|
{
|
||||||
// load models
|
// load models
|
||||||
privData = new myData();
|
privData = new myData();
|
||||||
privData->model = Oyster::Graphics::API::CreateModel(L"crate");
|
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
|
||||||
|
privData->model->WorldMatrix = modelInit.world;
|
||||||
|
privData->model->Visible = modelInit.visible;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void C_Player::setPos()
|
void C_Player::setPos()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ private:
|
||||||
public:
|
public:
|
||||||
C_Player(void);
|
C_Player(void);
|
||||||
~C_Player(void);
|
~C_Player(void);
|
||||||
void Init();
|
void Init(ModelInitData modelInit);
|
||||||
void setPos();
|
void setPos();
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
|
|
|
@ -20,11 +20,14 @@ C_StaticObj::~C_StaticObj(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
void C_StaticObj::Init()
|
void C_StaticObj::Init(ModelInitData modelInit)
|
||||||
{
|
{
|
||||||
// load models
|
// load models
|
||||||
privData = new myData();
|
privData = new myData();
|
||||||
privData->model = Oyster::Graphics::API::CreateModel(L"worldDummy");
|
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
|
||||||
|
privData->model->WorldMatrix = modelInit.world;
|
||||||
|
privData->model->Visible = modelInit.visible;
|
||||||
|
|
||||||
}
|
}
|
||||||
void C_StaticObj::setPos()
|
void C_StaticObj::setPos()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ private:
|
||||||
public:
|
public:
|
||||||
C_StaticObj(void);
|
C_StaticObj(void);
|
||||||
virtual ~C_StaticObj(void);
|
virtual ~C_StaticObj(void);
|
||||||
void Init();
|
void Init(ModelInitData modelInit);
|
||||||
void setPos();
|
void setPos();
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include "C_UIobject.h"
|
||||||
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
|
using namespace DanBias::Client;
|
||||||
|
|
||||||
|
struct C_UIobject::myData
|
||||||
|
{
|
||||||
|
myData(){}
|
||||||
|
Oyster::Math3D::Float4x4 view;
|
||||||
|
Oyster::Math3D::Float4x4 proj;
|
||||||
|
Oyster::Graphics::Model::Model *model;
|
||||||
|
}privData;
|
||||||
|
|
||||||
|
C_UIobject::C_UIobject(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
C_UIobject::~C_UIobject(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void C_UIobject::Init(ModelInitData modelInit)
|
||||||
|
{
|
||||||
|
// load models
|
||||||
|
privData = new myData();
|
||||||
|
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
|
||||||
|
privData->model->WorldMatrix = modelInit.world;
|
||||||
|
privData->model->Visible = modelInit.visible;
|
||||||
|
|
||||||
|
}
|
||||||
|
void C_UIobject::setPos()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_UIobject::Render()
|
||||||
|
{
|
||||||
|
Oyster::Graphics::API::RenderModel(*(privData->model));
|
||||||
|
}
|
||||||
|
void C_UIobject::Release()
|
||||||
|
{
|
||||||
|
Oyster::Graphics::API::DeleteModel(privData->model);
|
||||||
|
delete privData;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
#pragma once
|
||||||
|
#include "../C_Object.h"
|
||||||
|
namespace DanBias
|
||||||
|
{
|
||||||
|
namespace Client
|
||||||
|
{
|
||||||
|
class C_UIobject : public C_Object
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
struct myData;
|
||||||
|
myData* privData;
|
||||||
|
public:
|
||||||
|
C_UIobject(void);
|
||||||
|
virtual ~C_UIobject(void);
|
||||||
|
void Init(ModelInitData modelInit);
|
||||||
|
void setPos();
|
||||||
|
|
||||||
|
void Render();
|
||||||
|
void Release();
|
||||||
|
};};};
|
|
@ -26,10 +26,16 @@ LobbyState::~LobbyState(void)
|
||||||
}
|
}
|
||||||
bool LobbyState::Init()
|
bool LobbyState::Init()
|
||||||
{
|
{
|
||||||
|
ModelInitData modelData;
|
||||||
|
|
||||||
|
modelData.world = Oyster::Math3D::Float4x4::identity;
|
||||||
|
modelData.visible = true;
|
||||||
|
modelData.modelPath = L"crate";
|
||||||
// load models
|
// load models
|
||||||
privData = new myData();
|
privData = new myData();
|
||||||
privData->object = new C_StaticObj();
|
privData->object = new C_StaticObj();
|
||||||
privData->object->Init();
|
|
||||||
|
privData->object->Init(modelData);
|
||||||
|
|
||||||
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
|
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);
|
//privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#pragma once
|
#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||||
|
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||||
|
|
||||||
#include "GameClientState.h"
|
#include "GameClientState.h"
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
@ -18,3 +20,4 @@ public:
|
||||||
bool Render();
|
bool Render();
|
||||||
bool Release();
|
bool Release();
|
||||||
};};};
|
};};};
|
||||||
|
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||||
|
|
Loading…
Reference in New Issue