From 1f90de4cb444e39e2f48ec492efb44dd7780820f Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 24 Feb 2014 19:45:13 +0100 Subject: [PATCH] some implemetations --- Code/DanBias.sln | 50 +++---------------- .../GameClient/GameClientState/GameState.cpp | 6 +-- .../GameClient/GameClientState/GamingUI.cpp | 4 ++ .../GameClientState/LanMenuState.cpp | 13 +++-- .../GameClient/GameClientState/LobbyState.cpp | 13 +++-- .../GameClient/GameClientState/MainState.cpp | 2 +- 6 files changed, 32 insertions(+), 56 deletions(-) diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 6835e750..c825e6ee 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -49,10 +49,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LevelLoader", "Game\LevelLo EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameServerDebugEnvironment", "Game\LanServer\GameServerDebugEnvironment\GameServerDebugEnvironment.vcxproj", "{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lab", "Lab", "{46A660B9-6BE9-411C-B366-235FD8F8A9BD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RawDeviceLab", "LabProjects\RawDeviceLab\RawDeviceLab.vcxproj", "{32DD438B-8C9C-49EF-9EA5-EB48951D869A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -701,7 +697,8 @@ Global {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.Build.0 = Release|Win32 - {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.ActiveCfg = Release|Win32 + {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.ActiveCfg = Release|x64 + {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.Build.0 = Release|x64 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Any CPU.ActiveCfg = Release|Win32 @@ -718,7 +715,8 @@ Global {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.Build.0 = Release|Win32 - {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 + {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.Build.0 = Release|x64 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Any CPU.ActiveCfg = Debug|Win32 @@ -735,7 +733,8 @@ Global {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.Build.0 = Release|Win32 - {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.ActiveCfg = Release|Win32 + {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.ActiveCfg = Release|x64 + {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.Build.0 = Release|x64 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Any CPU.ActiveCfg = Release|Win32 @@ -752,41 +751,10 @@ Global {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.Build.0 = Release|Win32 - {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 + {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.ActiveCfg = Release|x64 + {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.Build.0 = Release|x64 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|Win32.ActiveCfg = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|Win32.Build.0 = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|x64.ActiveCfg = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|x86.ActiveCfg = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Debug|x86.Build.0 = Debug|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|Any CPU.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|Mixed Platforms.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|Win32.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|Win32.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|x64.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|x86.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.MinSizeRel|x86.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|Any CPU.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|Win32.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|Win32.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|x64.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|x86.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.Release|x86.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|Mixed Platforms.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|Win32.Build.0 = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {32DD438B-8C9C-49EF-9EA5-EB48951D869A}.RelWithDebInfo|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -800,7 +768,6 @@ Global {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} = {20720CA7-795C-45AD-A302-9383A6DD503A} {8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A} {2A1BC987-AF42-4500-802D-89CD32FC1309} = {20720CA7-795C-45AD-A302-9383A6DD503A} - {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63} = {20720CA7-795C-45AD-A302-9383A6DD503A} {C4C76A8D-44C5-4452-9F61-39C7E01CBDB4} = {F156EEBC-0195-4020-8700-4433208DE12B} {3EA5F14D-2A71-4588-A69D-87C4571C580F} = {F156EEBC-0195-4020-8700-4433208DE12B} {7E3990D2-3D94-465C-B58D-64A74B3ECF9B} = {1322B12B-5E37-448A-AAAF-F637460DCB23} @@ -810,6 +777,5 @@ Global {604A12A7-07BF-4482-BDF3-7101C811F121} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} - {32DD438B-8C9C-49EF-9EA5-EB48951D869A} = {46A660B9-6BE9-411C-B366-235FD8F8A9BD} EndGlobalSection EndGlobal diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index bb0bdc90..abfa07f0 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -81,9 +81,6 @@ bool GameState::Init( SharedStateContent &shared ) gfxOp.GlobalTint = Math::Float3(1,1,1); Graphics::API::SetOptions(gfxOp); - //tell server ready - this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); - // DEGUG KEYS this->key_Reload_Shaders = false; this->key_Wireframe_Toggle = false; @@ -105,6 +102,9 @@ bool GameState::Init( SharedStateContent &shared ) ((RespawnUI*)respawnUI)->Init(); ((StatsUI*)statsUI)->Init(); + //tell server ready + this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); + return true; } diff --git a/Code/Game/GameClient/GameClientState/GamingUI.cpp b/Code/Game/GameClient/GameClientState/GamingUI.cpp index 56b8f98f..68e62f10 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.cpp +++ b/Code/Game/GameClient/GameClientState/GamingUI.cpp @@ -38,6 +38,10 @@ bool GamingUI::Init() 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)); + // setting input mode to all raw + this->keyboardInput->Activate(); + this->mouseInput->Activate(); + return true; } GameStateUI::UIState GamingUI::Update( float deltaTime ) diff --git a/Code/Game/GameClient/GameClientState/LanMenuState.cpp b/Code/Game/GameClient/GameClientState/LanMenuState.cpp index 8cca6cf4..d8361503 100644 --- a/Code/Game/GameClient/GameClientState/LanMenuState.cpp +++ b/Code/Game/GameClient/GameClientState/LanMenuState.cpp @@ -30,7 +30,8 @@ struct LanMenuState::MyData NetworkClient *nwClient; ::Input::Mouse *mouseInput; ::Input::Keyboard *keyboardInput; - Graphics::API::Texture background; + Float3 mousePos; + Graphics::API::Texture background, mouseCursor; EventButtonCollection guiElements; TextField *connectIP; @@ -58,6 +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" ); // create guiElements this->privData->connectIP = new TextField( L"color_white.png", Float4(1.0f), Float4(0.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None ); @@ -92,11 +94,11 @@ GameClientState::ClientState LanMenuState::Update( float deltaTime ) { MouseInput mouseState; { - ::Input::Struct::SAIPointInt2D pos; - this->privData->mouseInput->GetPixelPosition( pos ); + ::Input::Struct::SAIPointFloat2D pos; + this->privData->mouseInput->GetNormalizedPosition( pos ); - mouseState.x = pos.x; - mouseState.y = pos.y; + this->privData->mousePos.x = mouseState.x = pos.x; + this->privData->mousePos.y = mouseState.y = pos.y; mouseState.mouseButtonPressed = this->privData->mouseInput->IsBtnDown( ::Input::Enum::SAMI_MouseLeftBtn ); } EventHandler::Instance().Update( mouseState ); @@ -110,6 +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->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); diff --git a/Code/Game/GameClient/GameClientState/LobbyState.cpp b/Code/Game/GameClient/GameClientState/LobbyState.cpp index c47febbe..62303865 100644 --- a/Code/Game/GameClient/GameClientState/LobbyState.cpp +++ b/Code/Game/GameClient/GameClientState/LobbyState.cpp @@ -23,7 +23,8 @@ struct LobbyState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; ::Input::Mouse *mouseInput; - Graphics::API::Texture background; + Float3 mousePos; + Graphics::API::Texture background, mouseCursor;; EventButtonCollection guiElements; } privData; @@ -46,6 +47,7 @@ bool LobbyState::Init( SharedStateContent &shared ) this->privData->mouseInput = shared.mouseDevice; this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); + this->privData->mouseCursor = Graphics::API::CreateTexture( L"cursor_md.png" ); // create buttons ButtonRectangle *button; @@ -63,11 +65,11 @@ GameClientState::ClientState LobbyState::Update( float deltaTime ) { MouseInput mouseState; { - ::Input::Struct::SAIPointInt2D pos; - this->privData->mouseInput->GetPixelPosition( pos ); + ::Input::Struct::SAIPointFloat2D pos; + this->privData->mouseInput->GetNormalizedPosition( pos ); - mouseState.x = pos.x; - mouseState.y = pos.y; + this->privData->mousePos.x = mouseState.x = pos.x; + this->privData->mousePos.y = mouseState.y = pos.y; mouseState.mouseButtonPressed = this->privData->mouseInput->IsBtnDown( ::Input::Enum::SAMI_MouseLeftBtn ); } EventHandler::Instance().Update( mouseState ); @@ -79,6 +81,7 @@ bool LobbyState::Render( ) Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); + Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.01f), Float4(1.0f) ); Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); diff --git a/Code/Game/GameClient/GameClientState/MainState.cpp b/Code/Game/GameClient/GameClientState/MainState.cpp index a057ab74..25607be6 100644 --- a/Code/Game/GameClient/GameClientState/MainState.cpp +++ b/Code/Game/GameClient/GameClientState/MainState.cpp @@ -98,7 +98,7 @@ bool MainState::Render() Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.1f), Float4(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->mouseCursor, this->privData->mousePos, Float2(0.01f), Float4(1.0f) ); Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 0.9f), Float2(1.0f), Float4(63.0f/255.0f,73.0f/255.0f,127.0f/255.0f,0.6f) ); this->privData->guiElements.RenderTexture();