Options now has some different resolutions.

This commit is contained in:
Tleety
2016-03-11 14:11:58 +01:00
parent 4937bee46a
commit 44398eac58
4 changed files with 55 additions and 25 deletions
-2
View File
@@ -23,8 +23,6 @@ public:
private: private:
IRenderer* m_Renderer; IRenderer* m_Renderer;
void OnPlay(const Events::InputCommand& e);
void OnOptions(const Events::InputCommand& e);
void OpenSubMenu(const Events::InputCommand& e); void OpenSubMenu(const Events::InputCommand& e);
EventRelay<MainMenuSystem, Events::ButtonClicked> m_EClicked; EventRelay<MainMenuSystem, Events::ButtonClicked> m_EClicked;
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="OptionsOrigin" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd"> <Entity name="Options" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components> <Components>
<c:Transform/> <c:Transform/>
+45 -5
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="ServerList" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd"> <Entity name="Play" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components> <Components>
<c:ServerList> <c:ServerList>
@@ -12,7 +12,7 @@
<Entity name="Identities_Origin"> <Entity name="Identities_Origin">
<Components> <Components>
<c:Transform> <c:Transform>
<Position X="0" Y="0.181182757" Z="0"/> <Position X="0" Y="0.172000006" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -33,9 +33,10 @@
<Entity name="Background"> <Entity name="Background">
<Components> <Components>
<c:Sprite> <c:Sprite>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<BlurBackground>true</BlurBackground> <BlurBackground>true</BlurBackground>
<GlowMap></GlowMap>
<Color A="0.196078435" B="0" G="0" R="0"/> <Color A="0.196078435" B="0" G="0" R="0"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -48,9 +49,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<BlurBackground>true</BlurBackground> <BlurBackground>true</BlurBackground>
<GlowMap></GlowMap>
<Color A="0.588235319" B="1" G="1" R="1"/> <Color A="0.588235319" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
@@ -66,8 +68,9 @@
<Entity name="RefreshIcon"> <Entity name="RefreshIcon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Icons/rotate.png</DiffuseTexture> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/rotate.png</DiffuseTexture>
<Color A="1" B="1" G="0" R="1"/> <Color A="1" B="1" G="0" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -79,6 +82,43 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="Title_Origin">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="UnderLine">
<Components>
<c:Sprite>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
</c:Sprite>
<c:Transform>
<Position X="0.00500000035" Y="0.198000014" Z="0.0199999996"/>
<Scale X="0.270000011" Y="0.00100000005" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Text">
<Components>
<c:Text>
<Content>Servers</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Left/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="-0.131999999" Y="0.202000007" Z="0.0199999996"/>
<Scale X="0.0320000015" Y="0.0310000014" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children> </Children>
</Entity> </Entity>
+9 -17
View File
@@ -16,7 +16,7 @@ void MainMenuSystem::Update(double dt)
} }
void MainMenuSystem::OnPlay(const Events::InputCommand& e) void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
{ {
auto menus = m_World->GetComponents("Menu"); auto menus = m_World->GetComponents("Menu");
if (menus == nullptr) { if (menus == nullptr) {
@@ -37,7 +37,7 @@ void MainMenuSystem::OnPlay(const Events::InputCommand& e)
break; break;
} }
} else if (!m_OpenSubMenu.HasComponent("ServerList")) { } else if (m_OpenSubMenu.Name().compare(e.Command) != 0) {
//Menu is open, but not the right one, delete the old one and open a new one. //Menu is open, but not the right one, delete the old one and open a new one.
m_World->DeleteEntity(m_OpenSubMenu.ID); m_World->DeleteEntity(m_OpenSubMenu.ID);
m_OpenSubMenu = EntityWrapper::Invalid; m_OpenSubMenu = EntityWrapper::Invalid;
@@ -60,21 +60,10 @@ void MainMenuSystem::OnPlay(const Events::InputCommand& e)
} }
} }
void MainMenuSystem::OnOptions(const Events::InputCommand& e)
{
}
void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
{
}
bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e) bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
{ {
if (e.EntityName == "ServerIdentityConnect") { EntityWrapper entity = e.Entity;
EntityWrapper entity = e.Entity; if (entity.Name() == "ServerIdentityConnect") {
EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity"); EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity");
if(serverIdentityEntity.Valid()) { if(serverIdentityEntity.Valid()) {
Events::ConnectRequest event; Events::ConnectRequest event;
@@ -83,6 +72,9 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port); printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port);
m_EventBroker->Publish(event); m_EventBroker->Publish(event);
} }
} else if (entity.HasComponent("ConfigBtnResolution")) {
m_Renderer->SetResolution(Rectangle((int)entity["ConfigBtnResolution"]["Width"], (int)entity["ConfigBtnResolution"]["Height"]));
} }
return true; return true;
} }
@@ -100,12 +92,12 @@ bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e)
bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e) bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
{ {
if(e.Command == "Play" && e.Value == 1) { if(e.Command == "Play" && e.Value == 1) {
OnPlay(e); OpenSubMenu(e);
} else if (e.Command == "RefreshServerList" && e.Value == 1){ } else if (e.Command == "RefreshServerList" && e.Value == 1){
Events::SearchForServers event; Events::SearchForServers event;
m_EventBroker->Publish(event); m_EventBroker->Publish(event);
} else if (e.Command == "Options" && e.Value == 1) { } else if (e.Command == "Options" && e.Value == 1) {
OnOptions(e); OpenSubMenu(e);
} }
return true; return true;
} }