GL - fixed defines in headers - more structure for states
This commit is contained in:
parent
1f172b422a
commit
f0181ad9f4
|
@ -57,6 +57,7 @@ Global
|
|||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Debug|x64
|
||||
{0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -68,6 +69,7 @@ Global
|
|||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Debug|x64
|
||||
{F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -79,6 +81,7 @@ Global
|
|||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Debug|x64
|
||||
{4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -90,6 +93,7 @@ Global
|
|||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Debug|x64
|
||||
{34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -101,6 +105,7 @@ Global
|
|||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64
|
||||
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -124,6 +129,7 @@ Global
|
|||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64
|
||||
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
|
@ -168,6 +174,7 @@ Global
|
|||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Release|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
@ -185,6 +192,7 @@ Global
|
|||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
@ -196,6 +204,7 @@ Global
|
|||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64
|
||||
{B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
@ -207,6 +216,7 @@ Global
|
|||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.Build.0 = Debug|x64
|
||||
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
@ -218,6 +228,7 @@ Global
|
|||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Debug|x64.Build.0 = Debug|x64
|
||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
@ -240,6 +251,7 @@ Global
|
|||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64
|
||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
|
|
|
@ -189,26 +189,26 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="GameClientState\GameState\C_UIobject.cpp" />
|
||||
<ClCompile Include="GameClientState\Obj\C_UIobject.cpp" />
|
||||
<ClCompile Include="DanBiasGame_Impl.cpp" />
|
||||
<ClCompile Include="DLLMain.cpp" />
|
||||
<ClCompile Include="GameClientState\GameState\C_DynamicObj.cpp" />
|
||||
<ClCompile Include="GameClientState\Obj\C_DynamicObj.cpp" />
|
||||
<ClCompile Include="GameClientState\GameClientState.cpp" />
|
||||
<ClCompile Include="GameClientState\GameState.cpp" />
|
||||
<ClCompile Include="GameClientState\LobbyState.cpp" />
|
||||
<ClCompile Include="GameClientState\GameState\C_Player.cpp" />
|
||||
<ClCompile Include="GameClientState\GameState\C_StaticObj.cpp" />
|
||||
<ClCompile Include="GameClientState\Obj\C_Player.cpp" />
|
||||
<ClCompile Include="GameClientState\Obj\C_StaticObj.cpp" />
|
||||
<ClCompile Include="GameClientState\C_Object.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GameClientState\GameState\C_UIobject.h" />
|
||||
<ClInclude Include="GameClientState\GameState\C_DynamicObj.h" />
|
||||
<ClInclude Include="GameClientState\Obj\C_UIobject.h" />
|
||||
<ClInclude Include="GameClientState\Obj\C_DynamicObj.h" />
|
||||
<ClInclude Include="GameClientState\GameClientState.h" />
|
||||
<ClInclude Include="GameClientState\GameState.h" />
|
||||
<ClInclude Include="Include\DanBiasGame.h" />
|
||||
<ClInclude Include="GameClientState\LobbyState.h" />
|
||||
<ClInclude Include="GameClientState\GameState\C_Player.h" />
|
||||
<ClInclude Include="GameClientState\GameState\C_StaticObj.h" />
|
||||
<ClInclude Include="GameClientState\Obj\C_Player.h" />
|
||||
<ClInclude Include="GameClientState\Obj\C_StaticObj.h" />
|
||||
<ClInclude Include="GameClientState\C_Object.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace DanBias
|
|||
|
||||
public:
|
||||
Client::GameClientState* gameClientState;
|
||||
// gameClient;
|
||||
|
||||
} data;
|
||||
#pragma endregion
|
||||
|
@ -174,6 +175,7 @@ namespace DanBias
|
|||
HRESULT DanBiasGame::Update(float deltaTime)
|
||||
{
|
||||
inputObj->Update();
|
||||
|
||||
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
|
||||
state = m_data->gameClientState->Update(deltaTime, inputObj);
|
||||
|
||||
|
@ -195,7 +197,7 @@ namespace DanBias
|
|||
return E_FAIL;
|
||||
break;
|
||||
}
|
||||
m_data->gameClientState->Init();
|
||||
m_data->gameClientState->Init(); // send game client
|
||||
|
||||
}
|
||||
return S_OK;
|
||||
|
@ -209,17 +211,12 @@ namespace DanBias
|
|||
isPressed = 1;
|
||||
}
|
||||
|
||||
|
||||
//Oyster::Graphics::API::NewFrame(Oyster::Math3D::Float4x4::null, Oyster::Math3D::Float4x4::null);
|
||||
|
||||
wchar_t title[255];
|
||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||
SetWindowText(g_hWnd, title);
|
||||
|
||||
m_data->gameClientState->Render();
|
||||
|
||||
//Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#ifndef DANBIAS_CLIENT_COBJECT_H
|
||||
#define DANBIAS_CLIENT_COBJECT_H
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
namespace DanBias
|
||||
{
|
||||
|
@ -24,4 +25,4 @@ public:
|
|||
virtual void Render() = 0;
|
||||
virtual void Release() = 0;
|
||||
};};};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||
|
||||
#define NOMINMAX
|
||||
#include "L_inputClass.h"
|
||||
|
||||
|
@ -27,3 +29,4 @@ public:
|
|||
};
|
||||
};
|
||||
};
|
||||
#endif
|
|
@ -1,6 +1,8 @@
|
|||
#include "GameState.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
#include "GameState/C_Player.h"
|
||||
#include "Obj/C_Player.h"
|
||||
#include "Obj/C_DynamicObj.h"
|
||||
|
||||
using namespace DanBias::Client;
|
||||
|
||||
struct GameState::myData
|
||||
|
@ -8,7 +10,9 @@ struct GameState::myData
|
|||
myData(){}
|
||||
Oyster::Math3D::Float4x4 view;
|
||||
Oyster::Math3D::Float4x4 proj;
|
||||
C_Object* player;
|
||||
C_Object* object[3];
|
||||
int modelCount;
|
||||
gameStateState state;
|
||||
}privData;
|
||||
|
||||
GameState::GameState(void)
|
||||
|
@ -22,47 +26,100 @@ GameState::~GameState(void)
|
|||
}
|
||||
bool GameState::Init()
|
||||
{
|
||||
// load models
|
||||
privData = new myData();
|
||||
privData->state = gameStateState_loading;
|
||||
privData->state = LoadGame();
|
||||
return true;
|
||||
}
|
||||
GameState::gameStateState GameState::LoadGame()
|
||||
{
|
||||
LoadModels(L"map");
|
||||
InitCamera(Oyster::Math::Float3(0,0,5.4f));
|
||||
return gameStateState_playing;
|
||||
}
|
||||
bool GameState::LoadModels(std::wstring mapFile)
|
||||
{
|
||||
// open file
|
||||
// read file
|
||||
// init models
|
||||
privData->modelCount = 2;
|
||||
|
||||
ModelInitData modelData;
|
||||
|
||||
modelData.world = Oyster::Math3D::Float4x4::identity;
|
||||
modelData.visible = true;
|
||||
modelData.modelPath = L"worldDummy";
|
||||
// load models
|
||||
privData = new myData();
|
||||
privData->player = new C_Player;
|
||||
privData->player->Init(modelData);
|
||||
privData->object[0] = new C_Player();
|
||||
privData->object[0]->Init(modelData);
|
||||
|
||||
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,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);
|
||||
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,2));
|
||||
modelData.world = modelData.world * translate;
|
||||
modelData.modelPath = L"crate";
|
||||
|
||||
privData->object[1] = new C_DynamicObj();
|
||||
privData->object[1]->Init(modelData);
|
||||
return true;
|
||||
}
|
||||
bool GameState::InitCamera(Oyster::Math::Float3 startPos)
|
||||
{
|
||||
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),startPos);
|
||||
privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view);
|
||||
return true;
|
||||
}
|
||||
|
||||
GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyInput)
|
||||
{
|
||||
if(KeyInput->IsKeyPressed(DIK_L))
|
||||
switch (privData->state)
|
||||
{
|
||||
case gameStateState_loading:
|
||||
// load map
|
||||
// wait for all players
|
||||
LoadGame();
|
||||
privData->state = gameStateState_playing;
|
||||
break;
|
||||
case gameStateState_playing:
|
||||
// read server data
|
||||
// update objects
|
||||
if(KeyInput->IsKeyPressed(DIK_L))
|
||||
privData->state = GameState::gameStateState_end;
|
||||
break;
|
||||
case gameStateState_end:
|
||||
return ClientState_Lobby;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// send key input to server.
|
||||
return ClientState_Same;
|
||||
}
|
||||
bool GameState::Render()
|
||||
{
|
||||
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
Oyster::Graphics::API::SetProjection(privData->proj);
|
||||
Oyster::Graphics::API::NewFrame();
|
||||
privData->player->Render();
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
{
|
||||
privData->object[i]->Render();
|
||||
}
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
return true;
|
||||
}
|
||||
bool GameState::Release()
|
||||
{
|
||||
privData->player->Release();
|
||||
delete privData->player;
|
||||
privData->player = NULL;
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
{
|
||||
privData->object[i]->Release();
|
||||
delete privData->object[i];
|
||||
privData->object[i] = NULL;
|
||||
}
|
||||
|
||||
delete privData;
|
||||
privData = NULL;
|
||||
return true;
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
#pragma once
|
||||
#ifndef DANBIAS_CLIENT_GAMESTATE_H
|
||||
#define DANBIAS_CLIENT_GAMESTATE_H
|
||||
#include "GameClientState.h"
|
||||
#include "OysterMath.h"
|
||||
#include <string>
|
||||
namespace DanBias
|
||||
{
|
||||
namespace Client
|
||||
{
|
||||
class GameState : public GameClientState
|
||||
{
|
||||
enum gameStateState
|
||||
{
|
||||
gameStateState_loading,
|
||||
gameStateState_playing,
|
||||
gameStateState_end,
|
||||
};
|
||||
private:
|
||||
|
||||
struct myData;
|
||||
myData* privData;
|
||||
public:
|
||||
|
@ -14,8 +24,13 @@ public:
|
|||
~GameState(void);
|
||||
bool Init();
|
||||
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput);
|
||||
bool LoadModels(std::wstring mapFile);
|
||||
bool InitCamera(Oyster::Math::Float3 startPos);
|
||||
gameStateState LoadGame();
|
||||
|
||||
bool Render();
|
||||
bool Release();
|
||||
};
|
||||
};
|
||||
};
|
||||
#endif
|
|
@ -1,8 +1,10 @@
|
|||
#include "LobbyState.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
#include "OysterMath.h"
|
||||
#include "GameState/C_Player.h"
|
||||
#include "GameState/C_StaticObj.h"
|
||||
#include "Obj/C_Player.h"
|
||||
#include "Obj/C_StaticObj.h"
|
||||
#include "Obj/C_DynamicObj.h"
|
||||
|
||||
using namespace DanBias::Client;
|
||||
|
||||
struct LobbyState::myData
|
||||
|
@ -10,44 +12,74 @@ struct LobbyState::myData
|
|||
myData(){}
|
||||
Oyster::Math3D::Float4x4 view;
|
||||
Oyster::Math3D::Float4x4 proj;
|
||||
C_Object* object;
|
||||
C_Object* object[2];
|
||||
int modelCount;
|
||||
// UI object
|
||||
// game client*
|
||||
}privData;
|
||||
|
||||
|
||||
LobbyState::LobbyState(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
LobbyState::~LobbyState(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool LobbyState::Init()
|
||||
{
|
||||
privData = new myData();
|
||||
|
||||
// load models
|
||||
LoadModels(L"UImodels.txt");
|
||||
InitCamera(Oyster::Math::Float3(0,0,5.4f));
|
||||
return true;
|
||||
}
|
||||
bool LobbyState::LoadModels(std::wstring file)
|
||||
{
|
||||
// open file
|
||||
// read file
|
||||
// init models
|
||||
privData->modelCount = 2;
|
||||
|
||||
ModelInitData modelData;
|
||||
|
||||
modelData.world = Oyster::Math3D::Float4x4::identity;
|
||||
modelData.visible = true;
|
||||
modelData.modelPath = L"crate";
|
||||
// load models
|
||||
privData = new myData();
|
||||
privData->object = new C_StaticObj();
|
||||
privData->object[0] = new C_StaticObj();
|
||||
privData->object[0]->Init(modelData);
|
||||
|
||||
privData->object->Init(modelData);
|
||||
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,2));
|
||||
modelData.world = modelData.world * translate;
|
||||
|
||||
privData->object[1] = new C_DynamicObj();
|
||||
privData->object[1]->Init(modelData);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LobbyState::InitCamera(Oyster::Math::Float3 startPos)
|
||||
{
|
||||
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::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),startPos);
|
||||
privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view);
|
||||
|
||||
return true;
|
||||
}
|
||||
GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* KeyInput)
|
||||
{
|
||||
// picking
|
||||
// mouse events
|
||||
// different menus
|
||||
// play sounds
|
||||
// update animation
|
||||
// send data to server
|
||||
// check data from server
|
||||
|
||||
if( KeyInput->IsKeyPressed(DIK_G))
|
||||
return ClientState_Game;
|
||||
|
@ -58,17 +90,31 @@ bool LobbyState::Render()
|
|||
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
|
||||
|
||||
Oyster::Graphics::API::NewFrame();
|
||||
// render objects
|
||||
privData->object->Render();
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
{
|
||||
privData->object[i]->Render();
|
||||
}
|
||||
|
||||
// render effects
|
||||
|
||||
// render lights
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
return true;
|
||||
}
|
||||
bool LobbyState::Release()
|
||||
{
|
||||
privData->object->Release();
|
||||
delete privData->object;
|
||||
privData->object = NULL;
|
||||
for (int i = 0; i < privData->modelCount; i++)
|
||||
{
|
||||
privData->object[i]->Release();
|
||||
delete privData->object[i];
|
||||
privData->object[i] = NULL;
|
||||
}
|
||||
|
||||
delete privData;
|
||||
privData = NULL;
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
|
||||
#ifndef DANBIAS_CLIENT_LOBBYSTATE_H
|
||||
#define DANBIAS_CLIENT_LOBBYSTATE_H
|
||||
|
||||
#include "GameClientState.h"
|
||||
#include "OysterMath.h"
|
||||
#include <string>
|
||||
namespace DanBias
|
||||
{
|
||||
namespace Client
|
||||
|
@ -16,7 +18,18 @@ public:
|
|||
LobbyState(void);
|
||||
~LobbyState(void);
|
||||
bool Init();
|
||||
bool LoadModels(std::wstring file);
|
||||
bool InitCamera(Oyster::Math::Float3 startPos);
|
||||
ClientState Update(float deltaTime, InputClass* KeyInput);
|
||||
// create session lobby
|
||||
// join session lobby
|
||||
// set name
|
||||
// set rules
|
||||
// set map
|
||||
// ready
|
||||
// chat
|
||||
// kick
|
||||
|
||||
bool Render();
|
||||
bool Release();
|
||||
};};};
|
||||
|
|
Loading…
Reference in New Issue