GameServer - Added some functionality in windowshell

This commit is contained in:
Dennis Andersen 2014-01-31 10:50:38 +01:00
parent 34b6b29fc4
commit c9c562fda6
6 changed files with 73 additions and 20 deletions

View File

@ -56,7 +56,7 @@ namespace DanBias
{ {
WindowShell::CreateConsoleWindow(); WindowShell::CreateConsoleWindow();
if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC())) if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
return DanBiasClientReturn_Error; return DanBiasClientReturn_Error;
if( FAILED( InitDirect3D() ) ) if( FAILED( InitDirect3D() ) )

View File

@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
{ {
//set some stats that are appropriate to a player //set some stats that are appropriate to a player
Oyster::Physics::API::SimpleBodyDescription sbDesc; Oyster::Physics::API::SimpleBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float3(0,165,0); sbDesc.centerPosition = Oyster::Math::Float3(0,16,0);
sbDesc.size = Oyster::Math::Float3(4,7,4); sbDesc.size = Oyster::Math::Float3(4,7,4);
//create rigid body //create rigid body

View File

@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius)
API::SphericalBodyDescription sbDesc; API::SphericalBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1); sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
sbDesc.ignoreGravity = true; sbDesc.ignoreGravity = true;
sbDesc.radius = 150; sbDesc.radius = 8;
sbDesc.mass = 10e12f; sbDesc.mass = 10e12f;
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
@ -59,7 +59,7 @@ void Level::InitiateLevel(float radius)
// add gravitation // add gravitation
API::Gravity gravityWell; API::Gravity gravityWell;
gravityWell.gravityType = API::Gravity::GravityType_Well; gravityWell.gravityType = API::Gravity::GravityType_Well;
gravityWell.well.mass = 10e16f; gravityWell.well.mass = 10e14f;
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1); gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
API::Instance().AddGravity(gravityWell); API::Instance().AddGravity(gravityWell);
} }

View File

@ -92,9 +92,9 @@ namespace DanBias
Protocol_ObjectPosition p(world, 2); Protocol_ObjectPosition p(world, 2);
GameSession::gameSession->Send(*p.GetProtocol()); GameSession::gameSession->Send(*p.GetProtocol());
} }
GameLogic::IObjectData* obj = NULL; else if(dynamic_cast<GameLogic::ILevelData*>(movedObject))
if(dynamic_cast<GameLogic::ILevelData*>(movedObject))
{ {
GameLogic::IObjectData* obj = NULL;
obj = ((GameLogic::ILevelData*)movedObject)->GetObjectAt(0); obj = ((GameLogic::ILevelData*)movedObject)->GetObjectAt(0);
if(obj) if(obj)
{ {

View File

@ -291,6 +291,8 @@ bool NetworkClient::Connect(unsigned short port, const char serverIP[])
void NetworkClient::Disconnect() void NetworkClient::Disconnect()
{ {
if(!privateData) return;
privateData->connection.Disconnect(); privateData->connection.Disconnect();
privateData->thread.Terminate(); privateData->thread.Terminate();
} }

View File

@ -7,7 +7,11 @@
#include <Windows.h> #include <Windows.h>
struct cPOINT :public POINT
{
cPOINT() { x=(0); y=(0); }
cPOINT(int width, int height) { x=(width); y=(height); }
};
class WindowShell class WindowShell
{ {
public: public:
@ -28,23 +32,70 @@ public:
HCURSOR cursor; //!< Optional HCURSOR cursor; //!< Optional
HBRUSH background; //!< Optional HBRUSH background; //!< Optional
WINDOW_INIT_DESC() WINDOW_INIT_DESC(
HWND _parent = 0,
HINSTANCE _hInstance = 0,
WNDPROC _windowProcCallback = 0,
const wchar_t* _windowName = L"Window",
POINT _windowSize = cPOINT(800, 600),
POINT _windowPosition = cPOINT(0,0),
UINT _windowClassStyle = (CS_HREDRAW | CS_VREDRAW | CS_OWNDC),
UINT _windowStyle = (WS_POPUPWINDOW|WS_SYSMENU|WS_CAPTION),
HICON _icon = LoadIcon(0, IDI_APPLICATION),
HCURSOR _cursor = LoadCursor(NULL, IDC_ARROW),
HBRUSH _background = (HBRUSH)GetStockObject(BLACK_BRUSH)
)
{ {
parent = 0; parent = _parent;
hInstance = NULL; hInstance = _hInstance;
windowName = L"Window"; windowName = _windowName;
windowSize.x = 800; windowSize = _windowSize;
windowSize.y = 600; windowPosition = _windowPosition;
windowPosition.x = 0; windowProcCallback = _windowProcCallback;
windowPosition.y = 0; windowClassStyle = _windowClassStyle;
windowProcCallback = NULL; windowStyle = _windowStyle;
windowClassStyle = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; icon = _icon;
windowStyle = WS_POPUPWINDOW|WS_SYSMENU|WS_CAPTION; cursor = _cursor;
//windowStyle = WS_OVERLAPPEDWINDOW; background = _background;
}
WINDOW_INIT_DESC(
HWND _parent,
HINSTANCE _hInstance,
WNDPROC _windowProcCallback,
const wchar_t* _windowName,
cPOINT _windowSize,
cPOINT _windowPosition
)
{
parent = _parent;
hInstance = _hInstance;
windowName = _windowName;
windowSize = _windowSize;
windowPosition = _windowPosition;
windowProcCallback = _windowProcCallback;
windowClassStyle = (CS_HREDRAW | CS_VREDRAW | CS_OWNDC);
windowStyle = (WS_POPUPWINDOW|WS_SYSMENU|WS_CAPTION);
icon = LoadIcon(0, IDI_APPLICATION);
cursor = LoadCursor(NULL, IDC_ARROW);
background = (HBRUSH)GetStockObject(BLACK_BRUSH);
}
WINDOW_INIT_DESC(
const wchar_t* _windowName,
cPOINT _windowSize,
cPOINT _windowPosition
)
{
parent = 0;
hInstance = 0;
windowName = _windowName;
windowSize = _windowSize;
windowPosition = _windowPosition;
windowProcCallback = 0;
windowClassStyle = (CS_HREDRAW | CS_VREDRAW | CS_OWNDC);
windowStyle = (WS_POPUPWINDOW|WS_SYSMENU|WS_CAPTION);
icon = LoadIcon(0, IDI_APPLICATION); icon = LoadIcon(0, IDI_APPLICATION);
cursor = LoadCursor(NULL, IDC_ARROW); cursor = LoadCursor(NULL, IDC_ARROW);
background = (HBRUSH)GetStockObject(BLACK_BRUSH); background = (HBRUSH)GetStockObject(BLACK_BRUSH);
//background = (HBRUSH)GetStockObject(BACKGROUND_BLUE);(HBRUSH)(COLOR_WINDOW+1);
} }
}; };