
1034.4. The Spacewar Class
4.4 The Spacewar Class
As mentioned earlier, to create a game with the game engine we must create a new class that
inherits from the Game class. Let’s create a Spacewar class to demonstrate. e Spacewar
class is declared in spacewar.h, as shown in Listing 4.51.
// Programming 2D Games
// Copyright (c) 2011 by:
// Charles Kelly
// Chapter 4 spacewar.h v1.0
#ifndef _SPACEWAR_H // Prevent multiple definitions if this
#define _SPACEWAR_H // file is included in more than one place
#define WIN32_LEAN_AND_MEAN
#include "game.h"
// Spacewar is the class we create; it inherits from the Game class
class Spacewar : public Game
{
private: