post merge fixes

This commit is contained in:
Dander7BD 2014-02-21 12:09:38 +01:00
parent adda3c1fff
commit 9a470fc175
6 changed files with 19 additions and 47 deletions

View File

@ -20,7 +20,6 @@
#include "EventHandler/EventHandler.h" #include "EventHandler/EventHandler.h"
#include "GameClientState/SharedStateContent.h" #include "GameClientState/SharedStateContent.h"
#include "Win32/Win32ApplicationKeyboard.h"
#include "Utilities.h" #include "Utilities.h"
using namespace ::Oyster; using namespace ::Oyster;
@ -46,7 +45,6 @@ namespace DanBias
NetworkClient networkClient; NetworkClient networkClient;
SharedStateContent sharedStateContent; SharedStateContent sharedStateContent;
::Input::Win32ApplicationKeyboard *keyboardDevice_application;
bool serverOwner; bool serverOwner;
float capFrame; float capFrame;
@ -55,9 +53,7 @@ namespace DanBias
{ {
this->sharedStateContent.network = nullptr; this->sharedStateContent.network = nullptr;
this->sharedStateContent.mouseDevice = nullptr; this->sharedStateContent.mouseDevice = nullptr;
this->sharedStateContent.keyboardDevice_raw = nullptr; this->sharedStateContent.keyboardDevice = nullptr;
this->sharedStateContent.keyboardDevice_application =
this->keyboardDevice_application = new ::Input::Win32ApplicationKeyboard();
this->serverOwner = false; this->serverOwner = false;
this->capFrame = 0; this->capFrame = 0;
} }
@ -65,8 +61,7 @@ namespace DanBias
~DanBiasGamePrivateData() ~DanBiasGamePrivateData()
{ {
SafeDeleteInstance( this->sharedStateContent.mouseDevice ); SafeDeleteInstance( this->sharedStateContent.mouseDevice );
SafeDeleteInstance( this->sharedStateContent.keyboardDevice_raw ); SafeDeleteInstance( this->sharedStateContent.keyboardDevice );
SafeDeleteInstance( this->sharedStateContent.keyboardDevice_application );
} }
} data; } data;
} }
@ -177,16 +172,14 @@ namespace DanBias
MessageBox( 0, L"Could not initialize the mouseDevice.", L"Error", MB_OK ); MessageBox( 0, L"Could not initialize the mouseDevice.", L"Error", MB_OK );
return E_FAIL; return E_FAIL;
} }
data.sharedStateContent.mouseDevice->Disable();
data.sharedStateContent.keyboardDevice_raw = dynamic_cast<Input::Keyboard*>( ::Input::InputManager::Instance()->CreateDevice(Input::Enum::SAIType_Keyboard, handle) ); data.sharedStateContent.keyboardDevice= dynamic_cast<Input::Keyboard*>( ::Input::InputManager::Instance()->CreateDevice(Input::Enum::SAIType_Keyboard, handle) );
if( !data.sharedStateContent.keyboardDevice_raw ) if( !data.sharedStateContent.keyboardDevice )
{ {
MessageBox( 0, L"Could not initialize the raw keyboard device.", L"Error", MB_OK ); MessageBox( 0, L"Could not initialize the raw keyboard device.", L"Error", MB_OK );
return E_FAIL; return E_FAIL;
} }
data.keyboardDevice_application->Disable();
return S_OK; return S_OK;
} }
@ -275,25 +268,12 @@ namespace DanBias
LRESULT CALLBACK WindowCallBack(HWND handle, UINT message, WPARAM wParam, LPARAM lParam ) LRESULT CALLBACK WindowCallBack(HWND handle, UINT message, WPARAM wParam, LPARAM lParam )
{ {
//PAINTSTRUCT ps;
//HDC hdc;
switch ( message ) switch ( message )
{ {
//case WM_PAINT:
// hdc = BeginPaint( handle, &ps );
// EndPaint( handle, &ps );
//break;
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage( 0 ); PostQuitMessage( 0 );
break; break;
default: default: break;
if( DanBias::data.keyboardDevice_application->IsActive() )
{
DanBias::data.keyboardDevice_application->CaptureText( message, wParam );
}
break;
} }
return DefWindowProc( handle, message, wParam, lParam ); return DefWindowProc( handle, message, wParam, lParam );

View File

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

View File

@ -27,8 +27,7 @@ struct GameState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
::Input::Mouse *mouseInput; ::Input::Mouse *mouseInput;
::Input::Keyboard *keyboardInput_raw; ::Input::Keyboard *keyboardInput;
::Input::ApplicationKeyboard *keyboardInput_app;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_StaticObj>> *staticObjects;
::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects; ::std::map<int, ::Utility::DynamicMemory::UniquePointer<::DanBias::Client::C_DynamicObj>> *dynamicObjects;
@ -67,15 +66,11 @@ bool GameState::Init( SharedStateContent &shared )
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = shared.network; this->privData->nwClient = shared.network;
this->privData->mouseInput = shared.mouseDevice; this->privData->mouseInput = shared.mouseDevice;
this->privData->keyboardInput_raw = shared.keyboardDevice_raw; this->privData->keyboardInput = shared.keyboardDevice;
this->privData->keyboardInput_app = shared.keyboardDevice_application;
this->privData->staticObjects = &shared.staticObjects; this->privData->staticObjects = &shared.staticObjects;
this->privData->dynamicObjects = &shared.dynamicObjects; this->privData->dynamicObjects = &shared.dynamicObjects;
this->privData->lights = &shared.lights; this->privData->lights = &shared.lights;
this->privData->keyboardInput_app->Deactivate();
this->privData->mouseInput->Enable();
Graphics::API::Option gfxOp = Graphics::API::GetOption(); Graphics::API::Option gfxOp = Graphics::API::GetOption();
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y;
this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f );
@ -101,7 +96,7 @@ bool GameState::Init( SharedStateContent &shared )
} }
// create UI states // create UI states
this->gameUI = new GamingUI(this->privData->mouseInput, this->privData->keyboardInput_raw, this->privData->nwClient, &this->privData->camera); this->gameUI = new GamingUI(this->privData->mouseInput, this->privData->keyboardInput, this->privData->nwClient, &this->privData->camera);
this->respawnUI = new RespawnUI(this->privData->nwClient, 20); this->respawnUI = new RespawnUI(this->privData->nwClient, 20);
this->currGameUI = gameUI; this->currGameUI = gameUI;
((GamingUI*)gameUI)->Init(); ((GamingUI*)gameUI)->Init();
@ -268,8 +263,6 @@ bool GameState::Release()
Graphics::API::Option o = Graphics::API::GetOption(); Graphics::API::Option o = Graphics::API::GetOption();
if( privData ) if( privData )
{ {
this->privData->mouseInput->Disable();
auto staticObject = this->privData->staticObjects->begin(); auto staticObject = this->privData->staticObjects->begin();
for( ; staticObject != this->privData->staticObjects->end(); ++staticObject ) for( ; staticObject != this->privData->staticObjects->end(); ++staticObject )
{ {
@ -323,7 +316,7 @@ void GameState::ReadKeyInput()
#ifdef _DEBUG // DEGUG KEYS #ifdef _DEBUG // DEGUG KEYS
// Reload shaders // Reload shaders
if( this->privData->keyboardInput_raw->IsKeyDown(::Input::Enum::SAKI_R) ) if( this->privData->keyboardInput->IsKeyDown(::Input::Enum::SAKI_R) )
{ {
if( !this->key_Reload_Shaders ) if( !this->key_Reload_Shaders )
{ {
@ -337,7 +330,7 @@ void GameState::ReadKeyInput()
this->key_Reload_Shaders = false; this->key_Reload_Shaders = false;
// toggle wire frame render // toggle wire frame render
if( this->privData->keyboardInput_raw->IsKeyDown(::Input::Enum::SAKI_T) ) if( this->privData->keyboardInput->IsKeyDown(::Input::Enum::SAKI_T) )
{ {
if( !this->key_Wireframe_Toggle ) if( !this->key_Wireframe_Toggle )
{ {

View File

@ -29,7 +29,7 @@ struct LanMenuState::MyData
GameClientState::ClientState nextState; GameClientState::ClientState nextState;
NetworkClient *nwClient; NetworkClient *nwClient;
::Input::Mouse *mouseInput; ::Input::Mouse *mouseInput;
::Input::ApplicationKeyboard *keyboardInput; ::Input::Keyboard *keyboardInput;
Graphics::API::Texture background; Graphics::API::Texture background;
EventButtonCollection guiElements; EventButtonCollection guiElements;
@ -55,8 +55,7 @@ bool LanMenuState::Init( SharedStateContent &shared )
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = shared.network; this->privData->nwClient = shared.network;
this->privData->mouseInput = shared.mouseDevice; this->privData->mouseInput = shared.mouseDevice;
this->privData->keyboardInput = shared.keyboardDevice_application; this->privData->keyboardInput = shared.keyboardDevice;
this->privData->keyboardInput->Activate();
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" ); this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );

View File

@ -48,6 +48,7 @@ bool MainState::Init( SharedStateContent &shared )
this->privData->nextState = GameClientState::ClientState_Same; this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = shared.network; this->privData->nwClient = shared.network;
this->privData->mouseInput = shared.mouseDevice; this->privData->mouseInput = shared.mouseDevice;
//this->privData->mouseInput->
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" ); this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );

View File

@ -28,8 +28,7 @@ namespace DanBias { namespace Client
::Oyster::Network::NetworkClient *network; ::Oyster::Network::NetworkClient *network;
::Input::Mouse *mouseDevice; ::Input::Mouse *mouseDevice;
::Input::Keyboard *keyboardDevice_raw; ::Input::Keyboard *keyboardDevice;
::Input::ApplicationKeyboard *keyboardDevice_application;
}; };
} } } }