A simple-to-use Graphics Library - version for VS 2008
Written by Michael Main, University of Colorado at Boulder
- Download the BGI2008.zip file to your machine and store it
in a place that you can find it, e.g., your Desktop, your Lockerspace.
(More detail: right click on the link above and say "Save Link as",
then browse to a known location and say "OK".)
- Extract the files in this zip file. You can do this by
double-clicking on its icon and using the Extraction Wizard.
You can also use WinZip if you prefer. Remember what folder
the files are extracted to.
- This file contains a Visual Studio "solution" file (extension .sln).
Browse to the folder (using "My Computer") and double click on the file
"bgi.sln".
It will open up Visual Studio.
- The screen will look something like this (your panes may not be
in the same places as mine were.)
- Use the Project menu to "Add New Item".
- Choose the Code category, C++ File (.cpp) template and give
the file a name like "myfirstgraphics.cpp". The location should
be the folder where the BGI file was extracted to (that's the default).
- The editor will let you enter code now. You can copy
this program just as it is and paste it into the editor window.
- When you finish the editing, choose "Build / Build Solution".
There should be NO errors or warnings- if there are error messages you must
fix the problem before proceeding further.
- Once you have built the project successfully, then
choose "Debug / Start Without Debugging".
- Tada! Here is the output that the program generates. It is normal
for there to be two new windows on the screen. The one in front of
this shot is the graphics window. The window
behind that one is the "console window" - when you use "cout", the
output comes out in the console window. When you use graphics commands,
their output comes out in the graphics window.
- When a key is pressed, the graphics window closes (the closegraph()
command is executed). Then the console window says "Press any key to
continue..." and closes when you do.
- When you are finished with your first graphics program and
want to write another one, the easiest way is to continue using the
same project/solution. Just right click
on the name of the source file (.cpp file) and then Remove
- this will not delete the file, just take it out of the project.
Then you can start with adding a new item to the Project as above
and write your next program.