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
28 2. Windows Programming Fundamentals
HDC hdc; // Handle to device context
Listing 2.12. Handle to device context.
Text may be displayed in the window using the TextOut function. We will only be
using TextOut in this chapter so that we may test our text input code. In later chapters,
we will use dierent techniques for displaying text in our games. e rst parameter in
TextOut is our hdc variable. e code in Listing 2.13 is added to our WinProc function.
case WM_PAINT: // The window needs to be redrawn
hdc = BeginPaint(hwnd, &ps); // Get handle to device context
GetClientRect(hwnd, &rect); // Get the window rectangle
// Display the character
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