Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Determing what to render

Name: Anonymous 2011-11-17 1:43

Hey there /prog/

What's the best method to handle different "states" for rendering in my application?  I'm not too sure if this requires much time to process, but I'm sure there's a better method.

Currently I do:


...
namespace Worlds
{
    const int MainMenu = 0;
    const int Level = 1;
    const int Settings = 2;
}
...

//Loop:
switch (CurrentWorld)
{
    case Worlds:MainMenu:
        mainMenuWorld.draw();
    break;
    case Worlds::Level:
        levelWorld.draw();
    break;
    case Worlds::Settings:
        settingsWorld.draw();
    break;
}


"LevelWorld" Class's Draw Method:

switch (LevelID)
{
    case Levels::Grassland:
        grasslandLevel.draw();
    break;
    case Levels::Factory:
        factoryLevel.draw();
    break;
    case Levels::Town:
        townLevel.draw();
    break;
}


Obviously it's only an example, but I'm curious as to the best method for telling my application what it needs to render.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List