Skip to Content
Programming 2D Games
book

Programming 2D Games

by Charles Kelly
June 2012
Beginner
438 pages
15h 26m
English
A K Peters/CRC Press
Content preview from Programming 2D Games
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 dened
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning 3D Game Programming

Beginning 3D Game Programming

Tom Miller

Publisher Resources

ISBN: 9781466508705