Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - M1SMR

Pages: [1]
1
General / Re: Main function parameter not working ?
« on: February 24, 2016, 06:12:37 am »
The funny thing is Visual Studio gave no errors or warnings about this   :D

Thank you, i fixed it.

2
General / Main function parameter not working ?
« on: February 24, 2016, 05:22:36 am »
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(){...}

 

Pages: [1]