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();
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;
if( FAILED( InitDirect3D() ) )

View File

@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
{
//set some stats that are appropriate to a player
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);
//create rigid body

View File

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

View File

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

View File

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

View File

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