Help => General => Topic started by: Mansiepansie on May 14, 2015, 08:26:38 pm
Title: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 08:26:38 pm
Hello, i once again struck an issue.. however i dont understand why it does this.
I have 4 Menu options where everyone works except the one ingame.. it triggers after game is paused, i get trough the menu but when i get into the options menu in the ingame screen nothing works and brings me back to the intro screen instead of doing what i'm trying to tell the program to do, go back to the ingame menu or any menu at all, however it still goes back to the Intro screen.
Please help, thanks.
Sorry for tardiness
Title: Re: PONG Game Menu Events
Post by: shadowmouse on May 14, 2015, 08:28:53 pm
Could you post your code?
Title: Re: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 08:36:53 pm
// Within Game.cpp
void Game::ShowOptionMenu() { OptionMenu menu; while (true) { _mainWindow.clear(sf::Color::Transparent);
//Drawing filter game-background + scoreboard (left and right of menutext) static sf::RectangleShape filter(sf::Vector2f(SCREEN_WIDTH, SCREEN_HEIGHT)); filter.setFillColor(sf::Color(40, 40, 40, 70)); _gameBackground.Draw(_mainWindow); _gameObjectManager.DrawAll(_mainWindow); _mainWindow.draw(filter); _scoreBoard.draw(_mainWindow);
//Showing menu unsigned int result = menu.show(_mainWindow); _mainWindow.display();
Title: Re: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 08:38:22 pm
Everything but the void Game::ShowOptionMenu()
trying to go back to Paused/InGameMenu when i push Back to Ingame Menu
Title: Re: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 08:44:37 pm
Im new to programming, usually dont hang around at forums. So tell me if im posting something wrong, i have around 20+ headers, so i might not link everything correct.
Title: Re: PONG Game Menu Events
Post by: shadowmouse on May 14, 2015, 08:49:28 pm
Okay, you might not want to post 20 headers, just the functions where the problem is. Also, code tags are useful to make something readable.
Title: Re: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 09:18:36 pm
The Code doesn't show any errors, the problem for me seems to be
case OptionMenu::BACK_TO_MENU: _gameState = Game::Paused; return; default: break;
Not displaying what was intended, i want it to go back to the ingame menu wich is the Paused screen
Title: Re: PONG Game Menu Events
Post by: shadowmouse on May 14, 2015, 09:24:39 pm
try putting cout statements around the program so you can tell if it is that ShowInGameMenu() is being called but isn't working or if it isn't being called. If it is being called, can you post it. Also use code tags, which ware code and /code in square brackets. Also, default: break; is pointless.
Title: Re: PONG Game Menu Events
Post by: dabbertorres on May 14, 2015, 09:44:15 pm
case Game::Paused: ShowInGameMenu(); break; case Game::ShowingOptionMenu: ShowOptionMenu(); case Game::ShowingSplash: ShowSplashScreen(); break;
You're missing a break statement after the call to ShowOptionMenu.
Title: Re: PONG Game Menu Events
Post by: Mansiepansie on May 14, 2015, 10:29:03 pm