Hello, I´m writing a Menu for my Game at the moment.
I have made an enum GameMode with Menu,Game and Exit in the main file.
The main function has a GameMode GAMEMODE as a parameter with the standard value Menu.
In the main function is a switch case wich asks for the value of GAMEMODE.
But it seems like the standard value of the main funtion is not working, because it executes the Game first.
#include "Game.h"
enum GameMode{Menu,Game,Exit};
#define g_Framework (Game.getFramework())
#define g_Window (Game.getFramework()->getWindow())
void Game_Menu();
void Game_Play();
int main(GameMode GAMEMODE = Menu) {
while (GAMEMODE!=Exit)
{
switch (GAMEMODE) {
case Menu:
Game_Menu(); break;
case Game:
Game_Play(); break;
}
}
return 0;
}
void Game_Menu() {
sf::RenderWindow menu;
menu.create(sf::VideoMode(600, 400), "Menu");
while (menu.isOpen()) {
sf::Event event;
while (menu.pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
menu.close();
break;
}
}
menu.clear(sf::Color::White);
menu.display();
}
}
void Game_Play(){...}