Merge branch 'GameServer' of https://github.com/dean11/Danbias into GameClient

This commit is contained in:
lanariel 2014-02-21 11:50:22 +01:00
commit 957d73f0f7
36 changed files with 747 additions and 280 deletions

View File

@ -224,8 +224,11 @@
<ClCompile Include="GameClientState\MainState.cpp" />
<ClCompile Include="GameClientState\NetLoadState.cpp" />
<ClCompile Include="GameClientState\RespawnUI.cpp" />
<ClCompile Include="GameClientState\StatsUI.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameClientState\Buttons\Plane_UI.h" />
<ClInclude Include="GameClientState\Buttons\Text_UI.h" />
<ClInclude Include="GameClientState\Camera_Basic.h" />
<ClInclude Include="GameClientState\Buttons\ButtonEllipse.h" />
<ClInclude Include="GameClientState\Buttons\EventButtonGUI.h" />
@ -249,6 +252,7 @@
<ClInclude Include="GameClientState\NetLoadState.h" />
<ClInclude Include="GameClientState\RespawnUI.h" />
<ClInclude Include="GameClientState\SharedStateContent.h" />
<ClInclude Include="GameClientState\StatsUI.h" />
<ClInclude Include="Include\GameClient.h" />
<ClInclude Include="GameClientState\LobbyState.h" />
<ClInclude Include="GameClientState\C_Object.h" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -113,7 +113,7 @@ namespace DanBias
{
if(buttonText.size() > 0)
{
Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, -0.001f), size, size.y * 0.5f, textColor);
Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, +0.001f), size, size.y * 0.5f, textColor);
}
}

View File

@ -0,0 +1,51 @@
#ifndef DANBIAS_CLIENT_PLANE_UI_H
#define DANBIAS_CLIENT_PLANE_UI_H
#include "DllInterfaces/GFXAPI.h"
namespace DanBias
{
namespace Client
{
class Plane_UI
{
public:
Plane_UI( )
{
pos = Oyster::Math::Float3::null;
size = Oyster::Math::Float2::null;
tintColor = Oyster::Math::Float4(1);
texture = NULL;
}
Plane_UI( std::wstring textureName, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, Oyster::Math::Float4 tintColor = Oyster::Math::Float4(1))
: pos(pos), size(size), tintColor(tintColor)
{
CreateTexture(textureName);
}
virtual ~Plane_UI()
{
Oyster::Graphics::API::DeleteTexture(texture);
texture = NULL;
}
void CreateTexture(std::wstring textureName)
{
//Create texture
texture = Oyster::Graphics::API::CreateTexture(textureName);
}
virtual void RenderTexture() const
{
if(texture)
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, tintColor);
}
private:
Oyster::Math::Float3 pos;
Oyster::Math::Float2 size;
Oyster::Graphics::API::Texture texture;
Oyster::Math::Float4 tintColor;
};
}
}
#endif

View File

@ -0,0 +1,45 @@
#ifndef DANBIAS_CLIENT_TEXT_UI_H
#define DANBIAS_CLIENT_TEXT_UI_H
#include "DllInterfaces/GFXAPI.h"
namespace DanBias
{
namespace Client
{
class Text_UI
{
public:
Text_UI( )
{
pos = Oyster::Math::Float3::null;
size = Oyster::Math::Float2::null;
text = L"";
textColor = Oyster::Math::Float4(1);
}
Text_UI(std::wstring text, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, Oyster::Math::Float4 textColor = Oyster::Math::Float4(1))
: pos(pos), size(size), text(text), textColor(textColor)
{
}
void setText(std::wstring text)
{
this->text = text;
}
void RenderText() const
{
if(text.size() > 0)
{
Oyster::Graphics::API::RenderText(text, pos, size, size.y * 0.5f, textColor);
}
}
private:
Oyster::Math::Float3 pos;
Oyster::Math::Float2 size;
std::wstring text;
Oyster::Math::Float4 textColor;
};
}
}
#endif

View File

@ -9,6 +9,9 @@
#include "C_obj/C_DynamicObj.h"
#include "C_obj/C_StaticObj.h"
#include "Utilities.h"
#include "GamingUI.h"
#include "RespawnUI.h"
#include "StatsUI.h"
using namespace ::DanBias::Client;
using namespace ::Oyster;
@ -30,19 +33,6 @@ struct GameState::MyData
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_Light>> *lights;
bool key_forward;
bool key_backward;
bool key_strafeRight;
bool key_strafeLeft;
bool key_Shoot;
bool key_Jump;
// DEGUG KEYS
bool key_Reload_Shaders;
bool key_Wireframe_Toggle;
bool renderWhireframe;
// !DEGUG KEYS
C_Player player;
Camera_FPSV2 camera;
@ -73,11 +63,6 @@ bool GameState::Init( SharedStateContent &shared )
this->privData = new MyData();
this->privData->key_forward = false;
this->privData->key_backward = false;
this->privData->key_strafeRight = false;
this->privData->key_strafeLeft = false;
this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = shared.network;
this->privData->input = shared.input;
@ -98,9 +83,9 @@ bool GameState::Init( SharedStateContent &shared )
this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) );
// DEGUG KEYS
this->privData->key_Reload_Shaders = false;
this->privData->key_Wireframe_Toggle = false;
this->privData->renderWhireframe = false;
this->key_Reload_Shaders = false;
this->key_Wireframe_Toggle = false;
this->renderWhireframe = false;
// !DEGUG KEYS
auto light = this->privData->lights->begin();
@ -109,6 +94,14 @@ bool GameState::Init( SharedStateContent &shared )
light->second->Render();
}
// create UI states
this->gameUI = new GamingUI(this->privData->input, this->privData->nwClient, &this->privData->camera);
this->respawnUI = new RespawnUI(this->privData->nwClient, 20);
this->statsUI = new StatsUI();
this->currGameUI = gameUI;
((GamingUI*)gameUI)->Init();
((RespawnUI*)respawnUI)->Init();
((StatsUI*)statsUI)->Init();
return true;
}
@ -165,7 +158,25 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
GameClientState::ClientState GameState::Update( float deltaTime )
{
this->ReadKeyInput();
GameStateUI::UIState UIstate = this->currGameUI->Update( deltaTime );
switch (UIstate)
{
case DanBias::Client::GameStateUI::UIState_same:
break;
case DanBias::Client::GameStateUI::UIState_gaming:
break;
case DanBias::Client::GameStateUI::UIState_main_menu:
//this->privData->nextState =
break;
case DanBias::Client::GameStateUI::UIState_shut_down:
this->privData->nextState = ClientState_Quit;
break;
default:
break;
}
// DEBUG keybindings
ReadKeyInput();
return this->privData->nextState;
}
@ -190,19 +201,13 @@ bool GameState::Render()
if( dynamicObject->second )
{
dynamicObject->second->Render();
}
}
/*auto light = this->privData->lights->begin();
for( ; light != this->privData->lights->end(); ++light )
{
light->second->Render();
}*/
#ifdef _DEBUG
//RB DEBUG render wire frame
if(this->privData->renderWhireframe)
if(this->renderWhireframe)
{
Oyster::Graphics::API::StartRenderWireFrame();
@ -244,6 +249,24 @@ bool GameState::Render()
//!RB DEBUG
#endif
Oyster::Graphics::API::StartGuiRender();
// render gui elemnts
if(currGameUI->HaveGUIRender())
currGameUI->RenderGUI();
if(renderStats)
{
if(statsUI->HaveGUIRender())
statsUI->RenderGUI();
}
Oyster::Graphics::API::StartTextRender();
if(currGameUI->HaveTextRender())
currGameUI->RenderText();
if(renderStats)
{
if(statsUI->HaveTextRender())
statsUI->RenderText();
}
Oyster::Graphics::API::EndFrame();
return true;
}
@ -277,6 +300,27 @@ bool GameState::Release()
privData = NULL;
}
if(respawnUI)
{
respawnUI->Release();
delete respawnUI;
respawnUI = NULL;
}
if(gameUI)
{
gameUI->Release();
delete gameUI;
gameUI = NULL;
}
if(statsUI)
{
statsUI->Release();
delete statsUI;
statsUI = NULL;
}
currGameUI = NULL;
return true;
}
@ -284,152 +328,59 @@ void GameState::ChangeState( ClientState next )
{
this->privData->nextState = next;
}
void GameState::ReadKeyInput()
{
if( this->privData->input->IsKeyPressed(DIK_W) )
{
//if(!this->privData->key_forward)
{
this->privData->nwClient->Send( Protocol_PlayerMovementForward() );
this->privData->key_forward = true;
}
}
else
this->privData->key_forward = false;
if( this->privData->input->IsKeyPressed(DIK_S) )
{
//if( !this->privData->key_backward )
{
this->privData->nwClient->Send( Protocol_PlayerMovementBackward() );
this->privData->key_backward = true;
}
}
else
this->privData->key_backward = false;
if( this->privData->input->IsKeyPressed(DIK_A) )
{
//if( !this->privData->key_strafeLeft )
{
this->privData->nwClient->Send( Protocol_PlayerMovementLeft() );
this->privData->key_strafeLeft = true;
}
}
else
this->privData->key_strafeLeft = false;
if( this->privData->input->IsKeyPressed(DIK_D) )
{
//if( !this->privData->key_strafeRight )
{
this->privData->nwClient->Send( Protocol_PlayerMovementRight() );
this->privData->key_strafeRight = true;
}
}
else
this->privData->key_strafeRight = false;
//send delta mouse movement
{
static const float mouseSensitivity = Radian( 1.0f );
this->privData->camera.PitchDown( this->privData->input->GetPitch() * mouseSensitivity );
float yaw = this->privData->input->GetYaw();
//if( yaw != 0.0f ) //This made the camera reset to a specific rotation.
{
this->privData->nwClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity) );
}
}
// shoot
if( this->privData->input->IsKeyPressed(DIK_Z) )
{
if( !this->privData->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = true;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = false;
this->privData->nwClient->Send( playerShot );
this->privData->key_Shoot = true;
}
}
else
this->privData->key_Shoot = false;
if( this->privData->input->IsKeyPressed(DIK_X) )
{
if( !this->privData->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = true;
playerShot.utilityPressed = false;
this->privData->nwClient->Send( playerShot );
this->privData->key_Shoot = true;
}
}
else
this->privData->key_Shoot = false;
if( this->privData->input->IsKeyPressed(DIK_C) )
{
if( !this->privData->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = true;
this->privData->nwClient->Send( playerShot );
this->privData->key_Shoot = true;
}
}
else
this->privData->key_Shoot = false;
// jump
if( this->privData->input->IsKeyPressed(DIK_SPACE) )
{
if(!this->privData->key_Jump)
{
this->privData->nwClient->Send( Protocol_PlayerJump() );
this->privData->key_Jump = true;
}
}
else
this->privData->key_Jump = false;
// DEGUG KEYS
// Reload shaders
if( this->privData->input->IsKeyPressed(DIK_R) )
{
if( !this->privData->key_Reload_Shaders )
if( !this->key_Reload_Shaders )
{
#ifdef _DEBUG
Graphics::API::ReloadShaders();
Oyster::Graphics::API::ReloadShaders();
#endif
this->privData->key_Reload_Shaders = true;
this->key_Reload_Shaders = true;
}
}
else
this->privData->key_Reload_Shaders = false;
this->key_Reload_Shaders = false;
// toggle wire frame render
if( this->privData->input->IsKeyPressed(DIK_T) )
{
if( !this->privData->key_Wireframe_Toggle )
if( !this->key_Wireframe_Toggle )
{
this->privData->renderWhireframe = !this->privData->renderWhireframe;
this->privData->key_Wireframe_Toggle = true;
this->renderWhireframe = !this->renderWhireframe;
this->key_Wireframe_Toggle = true;
// DEBUG set you as dead when render wireframe
this->currGameUI = respawnUI;
// !DEBUG
}
}
else
this->privData->key_Wireframe_Toggle = false;
// !DEGUG KEYS
// TODO: implement sub-menu
}
{
this->key_Wireframe_Toggle = false;
// DEBUG set you as dead when render wireframe
this->currGameUI = gameUI;
// !DEBUG
}
// toggle wire frame render
if( this->privData->input->IsKeyPressed(DIK_TAB) )
{
if( !this->key_showStats )
{
this->renderStats = true;
this->key_showStats = true;
}
}
else
{
this->renderStats = false;
this->key_showStats = false;
}
}
const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState::NetEvent &message )
{
if( message.args.type == NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend )
@ -449,8 +400,22 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
switch(ID)
{
case protocol_Gameplay_ObjectPickup: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectDamage: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectHealthStatus: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectDamage:
{
Protocol_ObjectDamage decoded(data);
if( this->privData->myId == decoded.object_ID )
{
if(currGameUI == gameUI)
{
((GamingUI*)currGameUI)->SetHPtext(std::to_wstring(decoded.healthLost));
}
}
}
return GameClientState::event_processed;
case protocol_Gameplay_ObjectHealthStatus:
{
}
return GameClientState::event_processed;
case protocol_Gameplay_ObjectPosition:
{
Protocol_ObjectPosition decoded(data);
@ -515,19 +480,21 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
this->privData->player.updateRBWorld();
// !RB DEBUG
}
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
if( object )
else
{
object->setPos( position );
object->setRot( rotation );
object->updateWorld();
// RB DEBUG
object->setRBPos ( position );
object->setRBRot ( rotation );
object->updateRBWorld();
// !RB DEBUG
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
if( object )
{
object->setPos( position );
object->setRot( rotation );
object->updateWorld();
// RB DEBUG
object->setRBPos ( position );
object->setRBRot ( rotation );
object->updateRBWorld();
// !RB DEBUG
}
}
}
return GameClientState::event_processed;
@ -584,8 +551,46 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
case protocol_Gameplay_ObjectLeaveTeam: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectWeaponCooldown: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectWeaponEnergy: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectRespawn: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectDie: break; /** @todo TODO: implement */
case protocol_Gameplay_ObjectRespawn:
{
// set player pos
Protocol_ObjectRespawn decoded(data);
// move player. Remember to change camera
this->privData->camera.SetPosition( decoded.position );
this->privData->player.setPos( decoded.position );
this->privData->player.updateWorld();
// RB DEBUG
this->privData->player.setRBPos ( decoded.position );
this->privData->player.updateRBWorld();
// !RB DEBUG
this->currGameUI = this->gameUI;
}
return GameClientState::event_processed;
case protocol_Gameplay_ObjectDie:
{
Protocol_ObjectDie decoded(data);
// if is this player. Remember to change camera
if( this->privData->myId == decoded.objectID )
{
this->currGameUI = this->respawnUI;
// set countdown
((RespawnUI*)currGameUI)->SetCountdown( decoded.seconds );
}
}
return GameClientState::event_processed;
case protocol_Gameplay_ObjectDisconnectPlayer:
{
//Remove the disconnected player
Protocol_ObjectDisconnectPlayer decoded(data);
auto object = this->privData->dynamicObjects->find( decoded.objectID );
if( object != this->privData->dynamicObjects->end() )
{
object->second = nullptr;
this->privData->dynamicObjects->erase( object );
}
}
return GameClientState::event_processed;
default: break;
}
}

View File

@ -3,6 +3,7 @@
#include "GameClientState.h"
#include "OysterMath.h"
#include <string>
#include "GameStateUI.h"
namespace DanBias { namespace Client
{
@ -31,6 +32,16 @@ namespace DanBias { namespace Client
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
GameStateUI *currGameUI, *gameUI, *respawnUI, *statsUI;
// DEGUG KEYS
bool key_Reload_Shaders;
bool key_Wireframe_Toggle;
bool renderWhireframe;
bool key_showStats;
bool renderStats;
// !DEGUG KEYS
};
} }
#endif

View File

@ -1,5 +1,5 @@
#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
#ifndef DANBIAS_CLIENT_GAMESTATEUI_H
#define DANBIAS_CLIENT_GAMESTATEUI_H
#include "Utilities.h"
#include "NetworkClient.h"

View File

@ -6,6 +6,7 @@ using namespace ::DanBias::Client;
using namespace ::Oyster::Network;
using namespace ::GameLogic;
using namespace ::Utility::Value;
using namespace ::Oyster::Math;
GamingUI::GamingUI() :
GameStateUI()
@ -14,6 +15,8 @@ GamingUI::GamingUI() :
this->input = nullptr;
this->netClient = nullptr;
this->camera = nullptr;
this->plane = nullptr;
this->text = nullptr;
}
GamingUI::GamingUI( InputClass *input, NetworkClient *connection, Camera_FPSV2 *camera ) :
@ -25,38 +28,54 @@ GamingUI::GamingUI( InputClass *input, NetworkClient *connection, Camera_FPSV2 *
}
GamingUI::~GamingUI() { /* Do nothing */ }
bool GamingUI::Init()
{
// z value should be between 0.5 - 0.9 so that it will be behind other states
// add textures and text
this->plane = new Plane_UI(L"box_tex.png", Float3(0.5f, 0.0f, 0.5f), Float2(0.3f, 0.1f));
this->text = new Text_UI(L"hej", Float3(0.5f,0.0f,0.1f), Float2(0.1f,0.1f));
return true;
}
GameStateUI::UIState GamingUI::Update( float deltaTime )
{
ReadKeyInput();
return this->nextState;
}
bool GamingUI::HaveGUIRender() const
{
return false; // TODO: change to true when we want UI elements like a crosshair
return true;
}
bool GamingUI::HaveTextRender() const
{
return false; // TODO: change to true when we want UI elements like a chat window
return true;
}
void GamingUI::RenderGUI() const
{
// TODO: Render crosshairs and such here. Don't forget to adjust GamingUI::HaveGUIRender
this->plane->RenderTexture();
}
void GamingUI::RenderText() const
{
// TODO: Render chattext and such here. Don't forget to adjust GamingUI::HaveGUIRender
this->text->RenderText();
}
bool GamingUI::Release()
{
// TODO: Release UI components here.
if(this->plane)
delete this->plane;
if(this->text)
delete this->text;
return true;
}
void GamingUI::SetHPtext( std::wstring hp )
{
this->text->setText(hp);
}
void GamingUI::ReadKeyInput()
{
if( this->input->IsKeyPressed(DIK_W) )
@ -79,75 +98,78 @@ void GamingUI::ReadKeyInput()
this->netClient->Send( Protocol_PlayerMovementRight() );
}
// if( this->input->IsKeyPressed(DIK_R) )
// {
// if( !this->key_Reload_Shaders )
// {
//#ifdef _DEBUG
// Graphics::API::ReloadShaders();
//#endif
// this->key_Reload_Shaders = true;
// }
// }
// else
// this->key_Reload_Shaders = false;
//send delta mouse movement
//send delta mouse movement
{
static const float mouseSensitivity = Radian( 1.0f );
this->camera->PitchDown( this->input->GetPitch() * mouseSensitivity );
this->netClient->Send( Protocol_PlayerLeftTurn(this->input->GetYaw() * mouseSensitivity) );
float yaw = this->input->GetYaw();
//if( yaw != 0.0f ) //This made the camera reset to a specific rotation.
{
this->netClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity) );
}
}
// shoot
//if( this->input->IsKeyPressed(DIK_Z) )
//{
// if( !this->key_Shoot )
// {
// Protocol_PlayerShot playerShot;
// playerShot.primaryPressed = true;
// playerShot.secondaryPressed = false;
// playerShot.utilityPressed = false;
// this->netClient->Send( playerShot );
// this->key_Shoot = true;
// }
//}
//else
// this->key_Shoot = false;
//if( this->input->IsKeyPressed(DIK_X) )
//{
// if( !this->key_Shoot )
// {
// Protocol_PlayerShot playerShot;
// playerShot.primaryPressed = false;
// playerShot.secondaryPressed = true;
// playerShot.utilityPressed = false;
// this->netClient->Send( playerShot );
// this->key_Shoot = true;
// }
//}
//else
// this->key_Shoot = false;
//if( this->input->IsKeyPressed(DIK_C) )
//{
// if( !this->key_Shoot )
// {
// Protocol_PlayerShot playerShot;
// playerShot.primaryPressed = false;
// playerShot.secondaryPressed = false;
// playerShot.utilityPressed = true;
// this->netClient->Send( playerShot );
// this->key_Shoot = true;
// }
//}
//else
// this->key_Shoot = false;
if( this->input->IsKeyPressed(DIK_Z) )
{
if( !this->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = true;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = false;
this->netClient->Send( playerShot );
this->key_Shoot = true;
}
}
else
this->key_Shoot = false;
if( this->input->IsKeyPressed(DIK_X) )
{
if( !this->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = true;
playerShot.utilityPressed = false;
this->netClient->Send( playerShot );
this->key_Shoot = true;
}
}
else
this->key_Shoot = false;
if( this->input->IsKeyPressed(DIK_C) )
{
if( !this->key_Shoot )
{
Protocol_PlayerShot playerShot;
playerShot.primaryPressed = false;
playerShot.secondaryPressed = false;
playerShot.utilityPressed = true;
this->netClient->Send( playerShot );
this->key_Shoot = true;
}
}
else
this->key_Shoot = false;
// jump
if( this->input->IsKeyPressed(DIK_SPACE) )
{
this->netClient->Send( Protocol_PlayerJump() );
if(!this->key_Jump)
{
this->netClient->Send( Protocol_PlayerJump() );
this->key_Jump = true;
}
}
else
this->key_Jump = false;
if( this->input->IsKeyPressed(DIK_ESCAPE) )
{
this->nextState = GameStateUI::UIState_shut_down;
}
// !DEGUG KEYS
// TODO: implement sub-menu
}

View File

@ -4,6 +4,8 @@
#include "GameStateUI.h"
#include "L_inputClass.h"
#include "Camera_FPSV2.h"
#include "Buttons\Text_UI.h"
#include "Buttons\Plane_UI.h"
namespace DanBias { namespace Client
{
@ -12,6 +14,7 @@ namespace DanBias { namespace Client
public:
GamingUI( InputClass *input, ::Oyster::Network::NetworkClient *connection, Camera_FPSV2 *camera );
virtual ~GamingUI();
bool Init();
UIState Update( float deltaTime );
bool HaveGUIRender() const;
@ -19,12 +22,24 @@ namespace DanBias { namespace Client
void RenderGUI() const;
void RenderText() const;
bool Release();
void SetHPtext( std::wstring hp );
private:
InputClass *input;
::Oyster::Network::NetworkClient *netClient;
Camera_FPSV2 *camera;
// TODO add multiple UI elements
Text_UI* text;
Plane_UI* plane;
bool key_forward;
bool key_backward;
bool key_strafeRight;
bool key_strafeLeft;
bool key_Shoot;
bool key_Jump;
GamingUI();
void ReadKeyInput();
};

View File

@ -3,6 +3,7 @@
using namespace ::DanBias::Client;
using namespace ::Oyster::Network;
using namespace ::Utility::Value;
using namespace ::Oyster::Math;
RespawnUI::RespawnUI() :
GameStateUI()
@ -17,13 +18,23 @@ RespawnUI::RespawnUI( NetworkClient *connection, float delay ) :
{
this->netClient = connection;
this->countDown = delay;
this->text = nullptr;
}
RespawnUI::~RespawnUI() { /* Do nothing */ }
bool RespawnUI::Init()
{
// z value should be between 0.5 - 0.9 so that it will be behind other states
// add textures and text
this->text = new Text_UI(L"DEAD", Float3(0.5f,0.0f,0.5f), Float2(0.2f,0.2f));
return true;
}
GameStateUI::UIState RespawnUI::Update( float deltaTime )
{
this->countDown = Max( this->countDown - deltaTime, 0.0f );
// countDown == 0
// return UIState_gaming state;
return this->nextState;
}
@ -34,25 +45,32 @@ bool RespawnUI::HaveGUIRender() const
bool RespawnUI::HaveTextRender() const
{
return false; // TODO: change to true when we want UI elements like a chat window
return true; // TODO: change to true when we want UI elements like a chat window
}
void RespawnUI::RenderGUI() const
{
// TODO: We need?
// TODO:BLOODY SCREEN
}
void RespawnUI::RenderText() const
{
this->text->RenderText();
// TODO: Text countdown somewhere on screen would be nice
}
bool RespawnUI::Release()
{
// TODO: Release UI components here.
if(this->text)
delete this->text;
return true;
}
void RespawnUI::SetCountdown( float cd )
{
this->countDown = cd;
// this text should be rendered
}

View File

@ -2,6 +2,8 @@
#define DANBIAS_CLIENT_RESPAWN_UI_H
#include "GameStateUI.h"
#include "Buttons\Text_UI.h"
#include "Buttons\Plane_UI.h"
namespace DanBias { namespace Client
{
@ -10,18 +12,23 @@ namespace DanBias { namespace Client
public:
RespawnUI( ::Oyster::Network::NetworkClient *connection, float delay );
virtual ~RespawnUI();
bool Init();
// TODO countdown
UIState Update( float deltaTime );
bool HaveGUIRender() const;
bool HaveTextRender() const;
void RenderGUI() const;
void RenderText() const;
bool Release();
void SetCountdown( float cd );
private:
::Oyster::Network::NetworkClient *netClient;
float countDown;
// TODO add multiple UI elements
Text_UI* text;
RespawnUI();
};
} }

View File

@ -0,0 +1,65 @@
#include "StatsUI.h"
#include <Protocols.h>
#include "Utilities.h"
using namespace ::DanBias::Client;
using namespace ::GameLogic;
using namespace ::Utility::Value;
using namespace ::Oyster::Math;
StatsUI::StatsUI() :
GameStateUI()
{
/* Should never be called! */
this->plane = nullptr;
this->text = nullptr;
}
StatsUI::~StatsUI() { /* Do nothing */ }
bool StatsUI::Init()
{
// z value should be between 0.1 - 0.5 so that it will be in front of other states
// add textures and text for player stats
this->plane = new Plane_UI(L"box_tex.png", Float3(0.0f, 0.0f, 0.5f), Float2(0.3f, 0.1f));
this->text = new Text_UI(L"Stats", Float3(0.0f,0.0f,0.1f), Float2(0.1f,0.1f));
return true;
}
GameStateUI::UIState StatsUI::Update( float deltaTime )
{
return this->nextState;
}
bool StatsUI::HaveGUIRender() const
{
// Set true if UIstate have any plane to render
return true;
}
bool StatsUI::HaveTextRender() const
{
// Set true if UIstate have any text to render
return true;
}
void StatsUI::RenderGUI() const
{
// render all the planes
this->plane->RenderTexture();
}
void StatsUI::RenderText() const
{
// render all the text
this->text->RenderText();
}
bool StatsUI::Release()
{
// TODO: Release UI components here.
if(this->plane)
delete this->plane;
if(this->text)
delete this->text;
return true;
}

View File

@ -0,0 +1,34 @@
#ifndef DANBIAS_CLIENT_STATS_UI_H
#define DANBIAS_CLIENT_STATS_UI_H
#include "GameStateUI.h"
#include "Buttons\Text_UI.h"
#include "Buttons\Plane_UI.h"
namespace DanBias { namespace Client
{
class StatsUI : public GameStateUI
{
public:
StatsUI();
virtual ~StatsUI();
bool Init();
UIState Update( float deltaTime );
bool HaveGUIRender() const;
bool HaveTextRender() const;
void RenderGUI() const;
void RenderText() const;
bool Release();
// TODO add function to add a new players statistics
// TODO add function to remove a players statistics
private:
// TODO add multiple UI elements
// one for each player ingame
Text_UI* text;
Plane_UI* plane;
};
} }
#endif

View File

@ -106,6 +106,8 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
args.pushForce = pushForce;
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
if(hitCone) delete hitCone;
}
/********************************************************
@ -141,6 +143,8 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
args.pushForce = -pushForce;
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
if(hitCone) delete hitCone;
}
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
@ -150,5 +154,5 @@ void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);
delete hitSphere;
if(hitSphere) delete hitSphere;
}

View File

@ -2,37 +2,76 @@
#include "CollisionManager.h"
using namespace GameLogic;
using namespace Oyster::Math;
DynamicObject::DynamicObject()
:Object()
{
this->isReleased = false;
this->isActive = true;
}
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
:Object(rigidBody, EventOnCollision, type, objectID)
{
this->isReleased = false;
this->isActive = true;
}
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID)
:Object(rigidBody, EventOnCollision, type, objectID)
{
this->isReleased = false;
this->isActive = true;
}
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, Oyster::Math::Float extraDamageOnCollision)
:Object(rigidBody, EventOnCollision, type, objectID)
{
this->extraDamageOnCollision = extraDamageOnCollision;
this->isReleased = false;
this->isActive = true;
}
DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, Oyster::Math::Float extraDamageOnCollision)
:Object(rigidBody, EventOnCollision, type, objectID)
{
this->extraDamageOnCollision = extraDamageOnCollision;
this->isReleased = false;
this->isActive = true;
}
DynamicObject::~DynamicObject(void)
{
}
void DynamicObject::ReleaseDynamicObject()
{
//TODO: Inactivate the physics object
if(this->isReleased) return;
this->isReleased = true;
this->isActive = false;
this->lookDirection = Float3::null;
this->forwardDirection = Float3::null;
this->scale = Float3::null;
this->extraDamageOnCollision = 0;
}
bool DynamicObject::IsReleased()
{
return this->isReleased;
}
bool DynamicObject::IsActive()
{
return this->isActive;
}
void DynamicObject::Inactivate()
{
this->isActive = false;
}
void DynamicObject::Activate()
{
this->isActive = true;
this->isReleased = false;
}

View File

@ -22,7 +22,15 @@ namespace GameLogic
~DynamicObject(void);
void ReleaseDynamicObject();
bool IsReleased();
bool IsActive();
void Inactivate();
void Activate();
private:
bool isActive;
bool isReleased;
};

View File

@ -67,6 +67,17 @@ void Game::GetAllPlayerPositions() const
Game::PlayerData* Game::CreatePlayer()
{
//Se if there is a free player somewhere in our list
for (unsigned int i = 0; i < this->players.Size(); i++)
{
if(this->players[i] && this->players[i]->player->IsReleased())
{
//We give the body to someone else
this->players[i]->player->Activate();
return this->players[i];
}
}
// Find a free space in array or insert at end
int insert = InsertObject(this->players, (PlayerData*)0);
int freeID = 0;

View File

@ -43,8 +43,8 @@ namespace GameLogic
void Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right) override;
void TurnLeft(Oyster::Math3D::Float deltaLeftRadians ) override;
ObjectSpecialType GetObjectType() const override;
void Inactivate() override;
void Release() override;
Player *player;
};

View File

@ -106,6 +106,9 @@ namespace GameLogic
* @return The current player state
********************************************************/
virtual PLAYER_STATE GetState() const = 0;
virtual void Inactivate() = 0;
virtual void Release() = 0;
};
class ILevelData :public IObjectData

View File

@ -94,3 +94,11 @@ void Game::PlayerData::TurnLeft(Oyster::Math3D::Float deltaLeftRadians )
{
this->player->TurnLeft(deltaLeftRadians);
}
void Game::PlayerData::Inactivate()
{
this->player->Inactivate();
}
void Game::PlayerData::Release()
{
this->player->ReleaseDynamicObject();
}

View File

@ -293,6 +293,11 @@ bool Player::IsIdle()
return (this->playerState == PLAYER_STATE::PLAYER_STATE_IDLE);
}
void Player::Inactivate()
{
//this->
}
Oyster::Math::Float3 Player::GetPosition() const
{
return (Oyster::Math::Float3) this->rigidBody->GetState().centerPos;

View File

@ -63,6 +63,8 @@ namespace GameLogic
bool IsJumping();
bool IsIdle();
void Inactivate();
Oyster::Math::Float3 GetPosition() const;
Oyster::Math::Float3 GetLookDir() const;
Oyster::Math::Float4x4 GetOrientation() const;

View File

@ -292,6 +292,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectEnabled 356
struct Protocol_ObjectPositionRotation :public Oyster::Network::CustomProtocolObject
{
short object_ID;
@ -366,7 +367,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectEnabled 356
//#define protocol_Gameplay_ObjectEnabled 357
struct Protocol_ObjectEnable :public Oyster::Network::CustomProtocolObject
{
int objectID;
@ -399,7 +400,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectDisabled 357
//#define protocol_Gameplay_ObjectDisabled 358
struct Protocol_ObjectDisable :public Oyster::Network::CustomProtocolObject
{
int objectID;
@ -439,7 +440,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectCreate 358
//#define protocol_Gameplay_ObjectCreate 359
struct Protocol_ObjectCreate :public Oyster::Network::CustomProtocolObject
{
//ObjectType type; //ie player, box or whatever
@ -543,7 +544,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectCreatePlayer 359
//#define protocol_Gameplay_ObjectCreatePlayer 360
struct Protocol_ObjectCreatePlayer :public Oyster::Network::CustomProtocolObject
{
/*1*/ int object_ID;
@ -673,7 +674,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectJoinTeam 360
//#define protocol_Gameplay_ObjectJoinTeam 361
struct Protocol_ObjectJoinTeam :public Oyster::Network::CustomProtocolObject
{
int objectID;
@ -713,7 +714,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectLeaveTeam 361
//#define protocol_Gameplay_ObjectLeaveTeam 362
struct Protocol_ObjectLeaveTeam :public Oyster::Network::CustomProtocolObject
{
int objectID;
@ -745,7 +746,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectWeaponCooldown 362
//#define protocol_Gameplay_ObjectWeaponCooldown 363
struct Protocol_ObjectWeaponCooldown :public Oyster::Network::CustomProtocolObject
{
float seconds;
@ -777,7 +778,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectWeaponEnergy 363
//#define protocol_Gameplay_ObjectWeaponEnergy 364
struct Protocol_ObjectWeaponEnergy :public Oyster::Network::CustomProtocolObject
{
float energy;
@ -809,7 +810,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectRespawn 364
//#define protocol_Gameplay_ObjectRespawn 365
struct Protocol_ObjectRespawn :public Oyster::Network::CustomProtocolObject
{
float position[3];
@ -852,7 +853,7 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectDie 365
//#define protocol_Gameplay_ObjectDie 366
struct Protocol_ObjectDie :public Oyster::Network::CustomProtocolObject
{
int objectID;
@ -892,6 +893,38 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol;
};
//#define protocol_Gameplay_ObjectDisconnectPlayer 367
struct Protocol_ObjectDisconnectPlayer :public Oyster::Network::CustomProtocolObject
{
int objectID;
Protocol_ObjectDisconnectPlayer()
{
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
this->protocol[0].value.netShort = protocol_Gameplay_ObjectDisconnectPlayer;
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
this->objectID = 0;
}
Protocol_ObjectDisconnectPlayer(int objectID)
{
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
this->protocol[0].value.netShort = protocol_Gameplay_ObjectDisconnectPlayer;
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
this->objectID = objectID;
}
Protocol_ObjectDisconnectPlayer(Oyster::Network::CustomNetProtocol& p)
{
this->objectID = p[1].value.netInt;
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = this->objectID;
return protocol;
}
private:
Oyster::Network::CustomNetProtocol protocol;
};
}
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H

View File

@ -69,6 +69,7 @@
#define protocol_Gameplay_ObjectWeaponEnergy 364
#define protocol_Gameplay_ObjectRespawn 365
#define protocol_Gameplay_ObjectDie 366
#define protocol_Gameplay_ObjectDisconnectPlayer 367
#define protocol_GameplayMAX 399

View File

@ -55,6 +55,7 @@ namespace DanBias
GameLogic::IPlayerData* ReleasePlayer();
Oyster::Network::NetClient ReleaseClient();
bool IsInvalid();
void Invalidate();
int IncrementFailedProtocol();
void ResetFailedProtocolCount();

View File

@ -25,12 +25,15 @@ GameClient::GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::Net
}
GameClient::~GameClient()
{
this->client = 0;
this->player = 0;
if(this->player)
this->player->Inactivate();
this->isReady = false;
this->character = L"crate_colonists.dan";
this->alias = L"Unknown";
this->secondsSinceLastResponse = 0.0f;
this->client = 0;
this->player = 0;
}
void GameClient::SetPlayer(GameLogic::IPlayerData* player)
@ -58,8 +61,14 @@ void GameClient::SetState(ClientState state)
this->state = state;
}
bool GameClient::IsInvalid()
{
return this->isInvalid;
}
void GameClient::Invalidate()
{
this->player->Release();
this->player = 0;
this->isInvalid = true;
this->isReady = false;
this->state = ClientState_Invalid;

View File

@ -61,14 +61,32 @@ using namespace DanBias;
switch (e.args.type)
{
case NetworkClient::ClientEventArgs::EventType_Disconnect:
{
printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
Protocol_ObjectDisconnectPlayer prot(this->gClients[temp]->GetPlayer()->GetID());
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if(i != temp && this->gClients[i]) this->gClients[i]->GetClient()->Send(prot);
}
this->gClients[temp]->Invalidate();
}
break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToRecieve:
break;
case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend:
{
if(this->gClients[temp]->IncrementFailedProtocol() >= 5/*client->threshold*/)
{
printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
Protocol_ObjectDisconnectPlayer prot(this->gClients[temp]->GetPlayer()->GetID());
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if(i != temp && this->gClients[i]) this->gClients[i]->GetClient()->Send(prot);
}
this->gClients[temp]->Invalidate();
}
}
break;
case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved:
this->ParseProtocol(e.args.data.protocol, cl);
@ -256,10 +274,17 @@ using namespace DanBias;
switch (p.status)
{
case GameLogic::Protocol_General_Status::States_disconected:
{
printf("Client with ID [%i] dissconnected\n", c->GetClient()->GetID());
//TODO: Tell other clients
//Protocol_
Protocol_ObjectDisconnectPlayer prot(c->GetPlayer()->GetID());
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if( this->gClients[i] && c->GetClient()->GetID() != this->gClients[i]->GetClient()->GetID() ) this->gClients[i]->GetClient()->Send(prot);
}
c->Invalidate();
this->Detach(c->GetClient()->GetID());
}
break;
case GameLogic::Protocol_General_Status::States_idle:

View File

@ -214,14 +214,21 @@ bool GameSession::Join(gClient gameClient)
{
for (unsigned int i = 0; i < this->gClients.Size(); i++)
{
if(this->gClients[i])
if(this->gClients[i] && !this->gClients[i]->IsInvalid())
{
IPlayerData* temp = this->gClients[i]->GetPlayer();
Protocol_ObjectCreatePlayer oc( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
Protocol_ObjectCreatePlayer p1( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
temp->GetID(), false, temp->GetTeamID(),
Utility::String::WStringToString(this->gClients[i]->GetAlias(), std::string()),
Utility::String::WStringToString(this->gClients[i]->GetCharacter(), std::string()));
nwClient->Send(oc);
nwClient->Send(p1);
temp = playerData;
Protocol_ObjectCreatePlayer p2( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
temp->GetID(), false, temp->GetTeamID(),
Utility::String::WStringToString(gameClient->GetAlias(), std::string()),
Utility::String::WStringToString(gameClient->GetCharacter(), std::string()));
this->gClients[i]->GetClient()->Send(p2);
}
}
}
@ -234,7 +241,7 @@ bool GameSession::Join(gClient gameClient)
{
//Protocol_ObjectPosition p(movedObject->GetPosition(), id);
Protocol_ObjectPositionRotation p(objects[i]->GetPosition(), objects[i]->GetRotation(), objects[i]->GetID());
GameSession::gameSession->Send(p.GetProtocol());
nwClient->Send(p.GetProtocol());
}
}

View File

@ -22,16 +22,16 @@ namespace Oyster
{
struct BroadcastOptions
{
//bool broadcast;
//float broadcastInterval;
//std::wstring subnetToBroadcast;
//CustomNetProtocol broadcastMessage;
//BroadcastOptions()
//{
// broadcast = true;
// broadcastInterval = 1.0f;
// subnetToBroadcast = L"192.168.0.1";
//}
bool broadcast;
float broadcastInterval;
std::wstring subnetToBroadcast;
CustomNetProtocol broadcastMessage;
BroadcastOptions()
{
broadcast = true;
broadcastInterval = 1.0f;
subnetToBroadcast = L"192.168.0.1";
}
} broadcastOptions;
struct MainOptions
@ -117,6 +117,23 @@ namespace Oyster
*/
int NetworkServer::GetPort();
/***************************************
Broadcast functions
***************************************/
//Set broadcast settings.
void SetBroadcast(CustomNetProtocol& broadcastMessage, float interval = 1.0f, bool enable = true);
//Set broadcast settings.
void SetBroadcastMessage(CustomNetProtocol& broadcastMessage);
//Enable/disable broadcast.
void SetBroadcast(bool enable);
//Set interval between each broadcast message in seconds.
void SetBroadcastInterval(float interval);
private:
struct PrivateData;
PrivateData* privateData;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

View File

@ -56,8 +56,8 @@ namespace Oyster
//size.x = size.x / (text.length() * TEXT_SPACING /2);
pos *= 2;
pos -= 1;
pos.xy *= 2;
pos.xy -= 1;
pos.y *= -1;

View File

@ -43,4 +43,5 @@ void main( uint3 DTid : SV_DispatchThreadID )
//Output[DTid.xy] = float4(Ambient[DTid.xy/2 + uint2(Output.Length*0.5f)].xyz,1);
//Output[DTid.xy] = SSAO * float4(1,1,1,1);
//Output[DTid.xy] = Ambient[DTid.xy];
}

View File

@ -413,3 +413,13 @@ float SimpleRigidBody::GetLambda() const
{
return this->rayLambda[0];
}
void SimpleRigidBody::MoveToLimbo()
{
this->rigidBody->setCollisionFlags(this->rigidBody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
}
void SimpleRigidBody::ReleaseFromLimbo()
{
this->rigidBody->setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT);
}

View File

@ -69,6 +69,9 @@ namespace Oyster
float GetLambda() const;
void MoveToLimbo();
void ReleaseFromLimbo();
private:
btCollisionShape* collisionShape;

View File

@ -169,6 +169,9 @@ namespace Oyster
virtual void CallSubscription_AfterCollisionResponse(ICustomBody* bodyA, ICustomBody* bodyB, Math::Float kineticEnergyLoss) = 0;
virtual void CallSubscription_Move() = 0;
virtual void MoveToLimbo() = 0;
virtual void ReleaseFromLimbo() = 0;
/********************************************************
* @return the void pointer set by SetCustomTag.
* nullptr if none is set.