A simple-to-use Graphics Library - version for VS 2008

Written by Michael Main, University of Colorado at Boulder

  1. 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".)
  2. 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.
  3. 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.
  4. The screen will look something like this (your panes may not be in the same places as mine were.)
  5. Use the Project menu to "Add New Item".
  6. 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).
  7. The editor will let you enter code now. You can copy this program just as it is and paste it into the editor window.
  8. 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.
  9. Once you have built the project successfully, then choose "Debug / Start Without Debugging".
  10. 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.
  11. 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.
  12. 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.