This chapter presented the essentials of game program code design. In professional games, you define classes for each type of object you see on the screen. You implement each class in a .h and a .cpp file. The .h file contains the class definition and the inline member functions. The .cpp file contains the out-of-line member functions. When speaking of the primary tasks that games perform, all game programs follow the same general design. They initialize the game, initialize a level, process messages in the main message loop, and update and render the frame. At the end of a level, they do any necessary level cleanup. At the end of the game, they perform whatever game cleanup is needed. Unfortunately, Ping isn't a very exciting game because it has no sound or music. The next chapter demonstrates how to fix that. |