NewInpuit - Pre-merge with gameclient

This commit is contained in:
dean11 2014-02-25 15:52:15 +01:00
parent b4ad883472
commit 0fd038be8c
5 changed files with 32 additions and 28 deletions

View File

@ -78,8 +78,8 @@ namespace DanBias
//if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
WindowShell::WINDOW_INIT_DESC winDesc;
winDesc.windowSize.x = 1280;
winDesc.windowSize.y = 720;
winDesc.windowSize.x = 1920;
winDesc.windowSize.y = 1080;
winDesc.windowProcCallback = WindowCallBack;
if(! data.window->CreateWin(winDesc) )
@ -152,7 +152,7 @@ namespace DanBias
Oyster::Graphics::API::Option p;
p.modelPath = L"..\\Content\\Models\\";
p.texturePath = L"..\\Content\\Textures\\";
p.Resolution = Oyster::Math::Float2( 1280.0f, 720.0f );
p.Resolution = Oyster::Math::Float2( 1920.0f, 1080.0f );
//! @todo fix proper amb value
p.AmbientValue = 1.3f;

View File

@ -42,17 +42,4 @@ namespace DanBias { namespace Client
};
} }
namespace Utility { namespace DynamicMemory
{ // template specializationto allowuse of dynamicmemory tools
template<>
inline void SafeDeleteInstance( ::DanBias::Client::GameStateUI *dynamicInstance )
{
if( dynamicInstance )
{
dynamicInstance->Release();
delete dynamicInstance;
}
}
} }
#endif

View File

@ -59,7 +59,7 @@ bool LanMenuState::Init( SharedStateContent &shared )
this->privData->keyboardInput = shared.keyboardDevice;
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );
this->privData->mouseCursor = Graphics::API::CreateTexture( L"cursor_md.png" );
this->privData->mouseCursor = Graphics::API::CreateTexture( L"cursor.png" );
// create guiElements
this->privData->connectIP = new TextField<LanMenuState*>( L"noedge-btn-ipfield.png", Float4(1.0f), Float4(1.0f), this, Float3(0.5f, 0.2f, 0.9f), Float2(0.5f, 0.05f), ResizeAspectRatio_Height );
@ -112,7 +112,7 @@ bool LanMenuState::Render( )
Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.01f), Float4(1.0f) );
Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.15f, 0.24), Float4(1.0f) );
Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) );
this->privData->guiElements.RenderTexture();
@ -133,7 +133,7 @@ void LanMenuState::ChangeState( ClientState next )
{
switch( next )
{
case GameClientState::ClientState_Lobby:
case GameClientState::ClientState_NetLoad:
// attempt to connect to lobby
if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) )
return;
@ -141,6 +141,8 @@ void LanMenuState::ChangeState( ClientState next )
default: break;
}
this->privData->keyboardInput->ReleaseTextTarget();
this->privData->nextState = next;
}
@ -149,7 +151,7 @@ void OnButtonInteract_Connect( Oyster::Event::ButtonEvent<LanMenuState*>& e )
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_Lobby );
e.owner->ChangeState( GameClientState::ClientState_NetLoad );
break;
default: break;
}

View File

@ -55,7 +55,7 @@ bool MainState::Init( SharedStateContent &shared )
this->privData->mousePos = Float3( 0.0f );
this->privData->background = Graphics::API::CreateTexture( L"color_white.png" );
this->privData->mouseCursor = Graphics::API::CreateTexture( L"cursor_md.png" );
this->privData->mouseCursor = Graphics::API::CreateTexture( L"cursor.png" );
// create buttons
ButtonRectangle<MainState*> *button;
@ -103,7 +103,11 @@ bool MainState::Render()
Graphics::API::NewFrame();
Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.01f), Float4(1.0f) );
if(this->privData->mouseInput->IsBtnDown(Input::Enum::SAMI_MouseLeftBtn))
Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.15f), Float4(1.0f) );
else
Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.15f, 0.24), Float4(1.0f) );
Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 0.9f), Float2(1.0f), Float4(0.0f, 0.0f, 0.0f, 1.0f) );
this->privData->guiElements.RenderTexture();

View File

@ -17,6 +17,7 @@ Win32Keyboard::Win32Keyboard(HWND target)
this->device.hwndTarget = target;
this->device.usUsage = RawInput_Usage_keyboard;
this->device.dwFlags = RIDEV_NOLEGACY;
this->writePos = 0;
memset(&this->keys[0], 0, sizeof(Win32Keyboard::Keys) * MAXKEYS);
}
Win32Keyboard::~Win32Keyboard()
@ -140,12 +141,20 @@ void Win32Keyboard::ProccessKeyboardData (RAWKEYBOARD keyboard)
}
else if (this->keys[SAKI_Left].isDown)
{
this->writePos = std::max( this->writePos - 1, (wstring::size_type)0 );
this->writePos = std::max( ((int)this->writePos) - 1, (int)(wstring::size_type)0 );
}
else if (this->keys[SAKI_Right].isDown)
{
this->writePos = std::min( this->writePos + 1, this->textTarget->size() );
}
else if (this->keys[SAKI_Enter].isDown || this->keys[SAKI_NumpadEnter].isDown)
{
this->textTarget->insert( this->writePos, 1, '\n');
}
else if ( this->keys[SAKI_Tab].isDown )
{
this->textTarget->insert( this->writePos, 1, '\t');
}
else if (virtualKey && !isUp)
{
wchar_t test = towlower((wchar_t)virtualKey);
@ -176,9 +185,11 @@ void Win32Keyboard::ProccessKeyboardData (RAWKEYBOARD keyboard)
else if(key == SAKI_0) test = L'}';
else if(key == SAKI_Add) test = L'\\';
}
this->textTarget->insert( this->writePos, 1, test);
++this->writePos;
}
}
}
@ -251,7 +262,7 @@ void Win32Keyboard::MapKey(RAWKEYBOARD& rawKB, SAKI& out_key, bool& isE0)
case VK_DELETE:
if (!isE0) out_key = SAKI_NumpadDecimal;
else out_key = SAKI_Delete;
break;
case VK_HOME:
@ -271,24 +282,24 @@ void Win32Keyboard::MapKey(RAWKEYBOARD& rawKB, SAKI& out_key, bool& isE0)
case VK_NEXT:
if (!isE0) out_key = SAKI_Numpad3;
break;
// the standard arrow keys will always have their e0 bit set, but the
// corresponding keys on the NUMPAD will not.
case VK_LEFT:
if (!isE0) out_key = SAKI_Numpad4;
else out_key = SAKI_Left;
break;
case VK_RIGHT:
if (!isE0) out_key = SAKI_Numpad6;
else out_key = SAKI_Right;
break;
case VK_UP:
if (!isE0) out_key = SAKI_Numpad8;
else out_key = SAKI_Up;
break;
case VK_DOWN: