ConnectRequest event and some other shit

This commit is contained in:
Tleety
2016-03-08 22:24:32 +01:00
parent 3394d65055
commit 95f68cc888
8 changed files with 1753 additions and 1702 deletions
+9 -22
View File
@@ -18,39 +18,26 @@ void MainMenuSystem::Update(double dt)
bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
{
if(e.EntityName == "Play") {
//OpenServerList
} else if(e.EntityName == "Connect") {
//Run connect code
} else if(e.EntityName == "Host") {
//Run host code
} else if(e.EntityName == "Quit") {
printf("No, you stay");
} else if (e.EntityName == "Res1080") {
glfwSetWindowSize(m_Renderer->Window(), 1920, 1080);
} else if (e.EntityName == "Res720") {
glfwSetWindowSize(m_Renderer->Window(), 1280, 720);
glViewport(0, 0, 1280, 720);
} else if (e.EntityName == "Res480") {
glfwSetWindowSize(m_Renderer->Window(), 854, 480);
glViewport(0, 0, 854, 480);
} else if (e.EntityName == "FullScreen") {
printf("No fullscreen for now");
if (e.EntityName == "ServerIdentityConnect") {
EntityWrapper entity = e.Entity;
EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity");
if(serverIdentityEntity.Valid()) {
Events::ConnectRequest event;
event.IP = (std::string)entity["ServerIdentity"]["IP"];
event.Port = (int)entity["ServerIdentity"]["Port"];
m_EventBroker->Publish(event);
}
}
return true;
}
bool MainMenuSystem::OnButtonRelease(const Events::ButtonReleased& e)
{
return true;
}
bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e)
{
return true;
}