This project is read-only.

GameStateManager drawing the states

May 17, 2011 at 7:58 PM


Just found your framework and it looks great! But I am having some problems using the GameStateManager.

So, I have a "GameStateManager gsManager;" instance in my game class. I have some game logic using some Push'es and Pop's and the gsManager.Update() is working fine.

But calling the gsManager.Draw(); inside the draw class of my game has no effect at all. I believe that's because I am pushing states to the GameStateManager that implement the GameState class, and that class (GameState) does not implement the DrawableComponent, which GameStateManager does.


What do you think is the best way to get around this? I'm kind of in a hurry for this...


Thank you,

Ricardo Belchior

May 17, 2011 at 8:05 PM

The GameStateManager behaves exactly like when you add an IGameComponent to the Game class' .Components collection: if it implements IUpdateable, call Update() on it. If it implements IDrawable, call Draw() on it.

So either implement the IDrawable interface in your game state,

or derive your game state from the DrawableGameState base class.

May 17, 2011 at 8:12 PM

oh right! didn't realize the DrawableGameState existed =x THX! sorry for your time


keep up the great work man!