Thanks! I managed to pull this off. Didn't need to change much tho, I had gameState variable, which changed depending on where I am in the game, my game loop has only switch instruction on current gameState:
And I changed fuctions to look like this:
I think I actually tried that before, but I must've made some mistake along the way. Thanks again
Code (cpp) Select
while (window.isOpen())
{
sf::Event event;
switch (menu.getGameState())
{
case 0:
menu.showMenu(event);
break;
case 1:
std::cout << "LvlChoose" << std::endl;
break;
case 2:
menu.showEdit(event);
break;
case 3:
std::cout << "Play" << std::endl;
break;
case 4:
std::cout << "Auto" << std::endl;
break;
case 5:
menu.showAbout(event);
break;
}
}
And I changed fuctions to look like this:
Code (cpp) Select
void Menu::showEdit(sf::Event & event)
{
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
editGui.handleEvent(event);
}
window.clear(sf::Color::White); // clear window with white color
editGui.draw();
window.display();
}
I think I actually tried that before, but I must've made some mistake along the way. Thanks again