| |||||||||||
|
Main Menu Other |
Tutorials -- Basic OpenGL Application | ||||||||||
|
Adding Source Code FilesLets add a source code file now. Open File-New and pick "C++ Source File" and name it "main" (that's just what I like to name my main file, name it whatever you like). Then go back into File-New and add a "C/C++ Header File" and name it "main". These are all the files you'll need for now. Look around for a FileView tab, it should be on the sidebar on your left. If you can't find it, hit Alt+0 (Alt Zero) to bring it up. Double click the "main.cpp" file. Then add to the top of this file this line:
For now lets leave it at that. Now open the "main.h" file. Quick Tip: right-click the #include line you just entered and choose 'Open Document "main.h"'. Add the following
Add these lines to define our main windows functions
Add these lines to globally define our main functions. What each one does is obvious to its name. Init() is called after the window is created but before we enter our main loop (more on this later). Resize(int w, int h) is called each time the user resizes our window. Display() handles drawing everything using OpenGL commands. Finally, Idle() is for calculating stuff like moving objects, collision detection, and other game-related stuff.
Update 11-14-99: Found that these lines are needed to get rid of a lot of useless warnings. Add these two lines to "main.h": // disable useless conversion warnings #pragma warning (disable:4244) #pragma warning (disable:4305) That's it for "main.h". Next Up: The Windows code.
|
|||||||||||