-
Book Overview & Buying
-
Table Of Contents
OpenGL Game Development By Example
By :
Now, it's time to actually write some code to implement input for our game. It turns out that some rudimentary input has already been implemented. This is because Windows is an event driven operating system and is already looking for input to occur. From a simplistic point of view, the main task of Windows (or any modern operating system) is to listen for events, and then do something based on those events.
So, whenever you hit a key on your keyboard, an event is triggered that wakes up Windows and says, "Hey, someone hit the keyboard!" Windows then passes that information to any programs that happen to be listening to keyboard events. The same occurs when you use the mouse.
We have already told our program that we want it to listen to events. Open RoboRacer.cpp and locate the WndProc function. WndProc is part of the code that was created for us when use used the Win32 Project template to start our game. WndProc is known as a callback function...
Change the font size
Change margin width
Change background colour