looks really nice. depending on how far you want to take it my favorite way to handle game states is to create an abstract base class State then inherit from it to create the new game states.
- Code: Select all
#ifndef _STATE_H_
#define _STATE_H_
#include "whatever.hpp"
class State
{
protected:
State() {}
public:
virtual ~State() {}
virtual void HandleEvents(SDL_Event* event) = 0;
virtual void Render(SDL_Surface* screen) = 0;
// add the functions that are in your TGame class
};
#endif
ok the constructor is protected because i make it a singleton now just inherit from this and overload the functions to do what your state dose then create a vector of states in the game class and create a pushState and popState that put and take off states and in the render and handle event functions just call states.back().Render(screen) or states.back().handleEvents(event);
ok now some other things would to be to add an image class that can load an image and render it to the screen just to make your life easier