Putting it all together

We can now put all of this knowledge together and implement as much as we can into our framework, with reusability in mind. We have quite a bit of work to do, so let's start with our abstract base class, GameObject. We are going to strip out anything SDL-specific so that we can reuse this class in other SDL projects if needed. Here is our stripped down GameObject abstract base class:

class GameObject

  virtual void draw()=0;
  virtual void update()=0;
  virtual void clean()=0;


  GameObject(const LoaderParams* pParams) {}
  virtual ~GameObject() {}

The pure virtual functions have been created, forcing any derived classes to also declare and implement them. There is also now no load function; the reason for this ...

Get SDL Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.