
210 8. Text
#include "image.h"
#include "text.h"
#include "constants.h"
Listing 8.1. Adding text.h to game.h.
Next, we create a pointer to a Text object. In this example, we named the pointer
fontCK (Listing 8.2). In the class constructor in threeCs.cpp, we create a new Text
object (Listing 8.3). We delete the Text object in the destructor (Listing 8.4). In our ini-
tialize function, we call the Text object’s initialize function. FONT_IMAGE is dened
in constants.h (Listing 8.5). We also need to add the appropriate calls to deal with a lost
graphics device (Listing 8.6). Printing text is typically done inside the render function of
the main Game ...