
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 ...