Game Development Reference
In-Depth Information
The preceding code seems absolutely fine for small examples which do not require many
resources or do not have any class structure. Let's imagine that we have a
GameObejct
class, which has two nice and tidy methods
GameObject::update()
and
GameOb-
ject::render()
. In the
update()
method, we handle the game logic and in
render()
, we render the object. This is what our main loop looks like:
Now suppose that we want some extra functionality from our class, which we want to im-
plement using OpenGL. Our class structure will look something like this: