diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj
index 1f0bf1ce..81fd9ebf 100644
--- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj
+++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj
@@ -215,6 +215,7 @@
+
@@ -237,6 +238,7 @@
+
diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
index 8691436d..c88739ff 100644
--- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
+++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp
@@ -8,6 +8,7 @@
#include "GameClientState\LobbyAdminState.h"
#include "GameClientState\MainState.h"
#include "GameClientState\LanMenuState.h"
+#include "GameClientState\NetLoadState.h"
#include
#include "NetworkClient.h"
#include
@@ -182,8 +183,8 @@ namespace DanBias
switch (state)
{
- case Client::GameClientState::ClientState_LobbyCreate:
- data.state = new Client::LobbyAdminState();
+ case Client::GameClientState::ClientState_Main:
+ data.state = new Client::MainState();
stateChanged = true;
break;
case Client::GameClientState::ClientState_Lan:
@@ -194,10 +195,18 @@ namespace DanBias
data.state = new Client::LobbyState();
stateChanged = true;
break;
+ case Client::GameClientState::ClientState_LobbyCreate:
+ data.state = new Client::LobbyAdminState();
+ stateChanged = true;
+ break;
case Client::GameClientState::ClientState_Game:
data.state = new Client::GameState();
stateChanged = true;
break;
+ case Client::GameClientState::ClientState_NetLoad:
+ data.state = new Client::NetLoadState();
+ stateChanged = true;
+ break;
case Client::GameClientState::ClientState_Quit:
data.state->Release();
return Result_quit;
diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h b/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h
index 3cfc7380..af9c4346 100644
--- a/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h
+++ b/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h
@@ -78,36 +78,35 @@ namespace DanBias { namespace Client
{
::Oyster::Math::Float lineStep = this->fontHeight + this->lineSpacing;
::Oyster::Math::Float2 rowSize = ::Oyster::Math::Float2( this->size.x, this->fontHeight );
+ ::Oyster::Math::Float3 fieldTopLeft = this->pos - Float3( this->size * 0.25f, 0.0f );
+ ::Oyster::Math::Float3 topLeft = fieldTopLeft;
if( this->isBottomAligned )
{
- ::Oyster::Math::Float3 topLeft = this->pos;
topLeft.y += this->size.y - lineStep;
auto line = this->lines.rbegin();
for( ; line != this->lines.rend(); ++line )
{
- if( topLeft.y - lineStep >= this->pos.y )
- {
- ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor );
- topLeft.y -= lineStep;
- }
- else break;
+ if( topLeft.y < fieldTopLeft.y )
+ break;
+
+ ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor );
+ topLeft.y -= lineStep;
}
}
else
{
- ::Oyster::Math::Float3 topLeft = this->pos;
+ topLeft.y += this->lineSpacing;
auto line = this->lines.begin();
for( ; line != this->lines.end(); ++line )
{
- if( topLeft.y + lineStep < this->size.y )
- {
- ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor );
- topLeft.y += lineStep;
- }
- else break;
+ if( topLeft.y >= fieldTopLeft.y + this->size.y )
+ break;
+
+ ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor );
+ topLeft.y += lineStep;
}
}
}
diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h
index a1936bab..9317413e 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h
+++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h
@@ -12,11 +12,12 @@ namespace DanBias { namespace Client
public:
enum ClientState
{
- ClientState_Login,
+ ClientState_Main,
ClientState_Lan,
ClientState_Lobby,
ClientState_LobbyCreate,
ClientState_LobbyReady,
+ ClientState_NetLoad,
ClientState_Game,
ClientState_Same,
ClientState_Quit
diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
index edcb5289..1bc77921 100644
--- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp
@@ -42,7 +42,7 @@ bool GameState::Init(NetworkClient* nwClient)
LoadGame();
//tell server ready
- nwClient->Send(GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready));
+ nwClient->Send( GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready) );
return true;
}
diff --git a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp
index 936d7c3c..f5699ce5 100644
--- a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp
@@ -36,6 +36,7 @@ struct LanMenuState::MyData
} privData;
void OnButtonInteract_Connect( Oyster::Event::ButtonEvent& e );
+void OnButtonInteract_Exit( Oyster::Event::ButtonEvent& e );
LanMenuState::LanMenuState() {}
@@ -55,19 +56,22 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient)
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
// create guiElements
- ButtonRectangle *guiElements;
-
- guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
- this->privData->guiElements.AddButton( guiElements );
-
- this->privData->connectIP = new TextField( L"earth_md.png", Float3(1.0f), this, Float3(0.1f, 0.2f, 0.5f), Float2(0.45f, 0.1f), ResizeAspectRatio_Width );
+ this->privData->connectIP = new TextField( L"earth_md.png", Float3(1.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None );
this->privData->connectIP->ReserveLines( 1 );
this->privData->connectIP->AppendText( L"127.0.0.1" );
- this->privData->connectIP->SetFontHeight( 0.1f );
- this->privData->connectIP->SetLineSpacing( 0.0f );
+ this->privData->connectIP->SetFontHeight( 0.08f );
+ this->privData->connectIP->SetLineSpacing( 0.005f );
+ this->privData->connectIP->SetTopAligned();
this->privData->guiElements.AddButton( this->privData->connectIP );
+ ButtonRectangle *guiElements;
+ guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
+ this->privData->guiElements.AddButton( guiElements );
+
+ guiElements = new ButtonRectangle( L"earth_md.png", L"Exit", Float3(1.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None );
+ this->privData->guiElements.AddButton( guiElements );
+
// bind guiElements collection to the singleton eventhandler
EventHandler::Instance().AddCollection( &this->privData->guiElements );
@@ -135,4 +139,15 @@ void OnButtonInteract_Connect( Oyster::Event::ButtonEvent& e )
break;
default: break;
}
-}
\ No newline at end of file
+}
+
+void OnButtonInteract_Exit( Oyster::Event::ButtonEvent& e )
+{
+ switch( e.state )
+ {
+ case ButtonState_Released:
+ e.owner->ChangeState( GameClientState::ClientState_Main );
+ break;
+ default: break;
+ }
+}
diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
index 8643c777..96ac9ca5 100644
--- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
+++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp
@@ -102,7 +102,7 @@ void LobbyState::ChangeState( ClientState next )
{
if( next == GameClientState::ClientState_LobbyReady )
{ // Send ready signal to server lobby
-
+ this->ChangeState( GameClientState::ClientState_NetLoad );
}
else
this->privData->nextState = next;