/* runGameLoop - This is the game loop management method. It runs continuously while the game is active. Once per frame it instructs the major game objects to get user input, record user input, update the GUI state, update the sprites' states using AI and input, perform collision detection and resolution (physics), render the screen, etc. This loop is timed such that everything is kept to a consistent framerate, thus the game should run consistently on all machines. */ void Game::runGameLoop() { // FIRST PROFILE? bool firstTimeThroughLoop = true; // LET'S START THE TIMER FROM SCRATCH timer->resetTimer(); // KEEP RENDERING UNTIL SOMEONE PULLS THE PLUG while(gsm->isAppActive()) { // MOVE ALONG WINDOWS MESSAGES, THIS ALLOWS // US TO GET USER INPUT os->processOSMessages(); // GET USER INPUT AND UPDATE GAME, GUI, OR PLAYER // STATE OR WHATEVER IS NECESSARY input->processInput(this); // IT IS POSSIBLE THE USER REQUESTED A SHUTDOWN // OF THE APP, SO WE NEED TO CHECK AGAIN if (gsm->isAppActive()) { // USE THE INPUT TO UPDATE THE GAME processGameData(); // AND RENDER THE GAME graphics->renderGame(this); } } }
/* runGameLoop - This is the game loop management method. It runs continuously while the game is active. Once per frame it instructs the major game objects to get user input, record user input, update the GUI state, update the sprites' states using AI and input, perform collision detection and resolution (physics), render the screen, etc. This loop is timed such that everything is kept to a consistent framerate, thus the game should run consistently on all machines. */ void Game::runGameLoop() { // FIRST PROFILE? bool firstTimeThroughLoop = true; // LET'S START THE TIMER FROM SCRATCH timer->resetTimer(); playMusic ("data\\music\\planetarium.mp3"); // KEEP RENDERING UNTIL SOMEONE PULLS THE PLUG while(gsm->isAppActive()) { // MOVE ALONG WINDOWS MESSAGES, THIS ALLOWS // US TO GET USER INPUT os->processOSMessages(); //Update FMOD system FMOD_System_Update (system); // GET USER INPUT AND UPDATE GAME, GUI, OR PLAYER // STATE OR WHATEVER IS NECESSARY input->processInput(this); // IT IS POSSIBLE THE USER REQUESTED A SHUTDOWN // OF THE APP, SO WE NEED TO CHECK AGAIN if (gsm->isAppActive()) { // USE THE INPUT TO UPDATE THE GAME processGameData(); // AND RENDER THE GAME if(black <= 0) graphics->renderGame(this); else{ graphics->getWorldRenderList()->clear(); black--; } } } }