Skip to content

Instantly share code, notes, and snippets.

@ambakshi
Created April 18, 2011 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambakshi/926473 to your computer and use it in GitHub Desktop.
Save ambakshi/926473 to your computer and use it in GitHub Desktop.
Explicit initialization and dependencies of subsystems.
int main(int argc, const char** argv) {
int flags = FlagsFromArgs(argc, argv);
Memory* memory = MemoryNew( MEMORY_HEAP_256MB | MEMORY_HEAP_DEBUG | flags );
Sound* sound = SoundNew( memory, SOUNDMGR_ALL_CHANELS | flags );
Renderer* renderer = RendererNew( memory, RENDERER_TRIPLE_BUFFER | RENDERER_SM_20 | flags );
Physics* phys = PhysicsNew( memory, sound, PHYSICS_AWESOME_FLAG | flags);
// .. etc ..
Game* game = GameNew( memory, sound, physics, ... , GAME_AAA_MODE | flags );
while(GameRunning(game)) {
// ...
};
int rc = GameDelete(game);
PhysicsDelete(phys);
RendererDelete(renderer);
SoundDelete(sound);
MemoryDelete(memory);
return rc;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment