Skip to Content
Programming 2D Games
book

Programming 2D Games

by Charles Kelly
June 2012
Beginner content levelBeginner
438 pages
15h 26m
English
A K Peters/CRC Press
Content preview from Programming 2D Games
834.2. The Game Class
{
// Start rendering
if (SUCCEEDED(graphics->beginScene()))
{
// Render is a pure virtual function that must be provided in the
// inheriting class.
render(); // Call render in derived class
// Stop rendering
graphics->endScene();
}
handleLostGraphicsDevice();
// Display the backbuffer on the screen
graphics->showBackbuffer();
}
Listing 4.11. e Game class renderGame function.
4.2.5 The Game Loop
Most games that contain any sort of animated graphics require a loop to control the anima-
tion. e loop is actually the main message loop in the WinMain function of winmain.cpp.
e game’s run function is repeatedly called from the main ...
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