Using the WinBGI Graphics Package

These are general instructions for creating a blank graphics project. Use this to start most of the projects.

Create a new project with the name given in class for that assignment. This part is just like the tutorial you already saw.  Here's a detailed summary:

Adding Existing Source Code

Since you'll be using these three files repeatedly, I suggest saving them somewhere easy to find in your My Documents (Called "Save Files Here" in the computer lab).

Minimal Graphics program:

Here's what the blank_graphics2.cpp program looks like. This program, along with the graphics2.h and winbgi2.cpp is sort of the bare minimum just to bring up a blank, black graphics window:

// Project Name:
// Author:
// Date  :

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "graphics2.h"

#define ESC 0x1b

void main()
    srand(time(NULL));  // Seed the random number generator
    int GraphDriver=0,GraphMode=0;
    initgraph( &GraphDriver, &GraphMode, "", 640, 480 ); // Start Window
    char tempstring[80];

    getch(); //Wait for a key. (When main function ends, the window will close)
} //end of main()

(Last Updated 6-Sep-2004, Matthew Weathers)