Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct State
- {
- enum { Game, /*...*/ } mode;
- struct
- {
- bool drawMinimap;
- } game;
- } State;
- // -----------------------
- class BaseScene
- {
- virtual void update();
- virtual void draw();
- };
- class Minimap : BaseScene
- {
- }
- class Game : Basescene
- {
- Minimap * minimap;
- void draw()
- {
- if(state.game.drawMinimap)
- minimap->draw();
- }
- }
- // -----------------------
- class Application
- {
- Game * game;
- void run()
- {
- while(...)
- {
- events();
- update();
- render();
- }
- }
- void render()
- {
- switch(state.mode)
- {
- case State::Game:
- game->draw();
- break;
- //...
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement