Created
December 5, 2014 00:15
-
-
Save awstanley/d7a79552ae1f86d3a45b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> // uint8_t | |
class Scene | |
{ | |
public: | |
virtual void Run() {} | |
Scene() {} | |
~Scene() {} | |
}; | |
int main(int argc, char **argv) | |
{ | |
// Init | |
bool running = true; | |
// Say 6 scenes: "splash", "main menu", "options", "game", "lobby", "exit" | |
uint8_t scene_count = 6; | |
Scene** scenes = new Scene[scene_count]; | |
// Create your scenes here abstracting from the above | |
// Start with the first scene (splash in this example) | |
uint8_t active_scene = 0; | |
while(running) | |
{ | |
// Perform a single execution switching if asked | |
active_scene = scenes[active_scene]->Run(); | |
}; | |
// Term/cleanup | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment