Summary


The first step in learning to write games is learning to program in C++ This chapter provided a brief introduction to writing programs in C++ using the free Dev-C++ compiler provided on the CD that comes with this book. For each program you write, you must create a project file and add source files to it. Your source files contain functions. One of the source files must contain the main() function, which is where every C++ program starts and ends. When you write your program, you must also compile and link it before you can run it.

Functions use the various tools that C++ provides. These tools include data types, variables, and streams. Functions such as main() pass information to other functions and get information back from them using parameter lists and return values. Functions often use the basic C++ math operators to do their work. The most common are addition, subtraction, multiplication, division, increment, and decrement. Functions use loops, such as the while and the do-while loops, to perform repetitive tasks.

Windows programs use a WinMain() function rather than a main() function. They process messages that are generated in response to events. Events are caused by such things as player input. The LlamaWords2D game engine provides a WinMain() function and some message-handling tools for you so that you can more easily overcome the challenge of learning Windows programming.

We've covered a lot of information in one chapter. However, the concepts presented in this chapter are fundamental to game programming in C++. You will use them in every program you write. So if it still all seems a bit overwhelming at this point, don't be concerned. Because you'll use these concepts in every program, you'll get lots of practice with them. I'll walk you through the process of applying these ideas to your games, beginning in the next chapter.



Creating Games in C++(c) A Step-by-Step Guide
Creating Games in C++: A Step-by-Step Guide
ISBN: 0735714347
EAN: 2147483647
Year: N/A
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net