From f0181ad9f45af79d930c3f1a5df4ef64addc4b40 Mon Sep 17 00:00:00 2001 From: Linda Andersson Date: Tue, 10 Dec 2013 11:26:18 +0100 Subject: [PATCH] GL - fixed defines in headers - more structure for states --- Code/DanBias.sln | 12 +++ Code/Game/DanBiasGame/DanBiasGame.vcxproj | 16 ++-- Code/Game/DanBiasGame/DanBiasGame_Impl.cpp | 9 +- .../DanBiasGame/GameClientState/C_Object.h | 5 +- .../GameClientState/GameClientState.h | 5 +- .../DanBiasGame/GameClientState/GameState.cpp | 93 +++++++++++++++---- .../DanBiasGame/GameClientState/GameState.h | 17 +++- .../GameClientState/LobbyState.cpp | 74 ++++++++++++--- .../DanBiasGame/GameClientState/LobbyState.h | 17 +++- 9 files changed, 196 insertions(+), 52 deletions(-) diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 32915f21..9ef6f418 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -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 diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index 41093543..1784ca35 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -189,26 +189,26 @@ - + - + - - + + - - + + - - + + diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 5698cb1d..535256f9 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -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; @@ -208,17 +210,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; } diff --git a/Code/Game/DanBiasGame/GameClientState/C_Object.h b/Code/Game/DanBiasGame/GameClientState/C_Object.h index adb79f54..8bfecdb9 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_Object.h +++ b/Code/Game/DanBiasGame/GameClientState/C_Object.h @@ -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 diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h index 3df91311..5277996d 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h @@ -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 \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 1b5926b0..fb81e23a 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -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; diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.h b/Code/Game/DanBiasGame/GameClientState/GameState.h index 315dd6e8..5ae6aa49 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameState.h @@ -1,12 +1,22 @@ -#pragma once +#ifndef DANBIAS_CLIENT_GAMESTATE_H +#define DANBIAS_CLIENT_GAMESTATE_H #include "GameClientState.h" +#include "OysterMath.h" +#include 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 \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index 5e956176..b107883f 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -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; diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.h b/Code/Game/DanBiasGame/GameClientState/LobbyState.h index cba06547..7498d448 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.h +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.h @@ -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 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(); };};};