SPiGoT: The Student Programmer's Graphics Toolkit

But I just want to draw some lines!

Graphics programs for MS-DOS are pretty easy to put together.  Pick a compiler like Borland C++ 3.1 for DOS, check off the box that says "Link to Graphics Library", read the documentation for graphics.h, and you're off and running with code not much more complicated than the following:
#include <graphics.h>

int main(int argc, char *argv[])

	// draw something
	line(0, 0, 100, 100);


	return 0;

Ok, but do I have to use MS-DOS?

But let's face it: It's 2005, and you shouldn't have to use MS-DOS. 1991 called, and they want their compiler back. Even if you're just writing console apps, you should be using a 32-bit Windows compiler if for no other reason than to save you hours tracking down null-pointer references. Not to mention that the IDEs are a lot nicer. The problem is that moving to Windows (or any GUI system, including MacOS, X-Window, Java, or even OS/2 PM) raises the bar considerably. GUIs may be easier to use, but they sure aren't easier to program. If you don't believe me, take a look at Programming Windows by Charles Petzold. The "Hello, world" program is about 50 lines of code.

Lowering the bar

Hence SPiGoT -- The Student Programmer's Graphics Toolkit. Link with spigot.lib, make sure spigot.dll is in the search path, and our original program is back to
#include "spigot.h"

void draw(void)
	DrawLine(0, 0, 100, 100);

void Initialize(void)
Much better.


Some might see the lack of other graphics primitives as a serious shortcoming. I prefer to see it as a feature designed to encourage students to experiment with scan conversion.


The whole raison d'être of this toolkit is to offer a limited number of features. The fewer features there are, the less code we need to write to get started.

Specifically, you'll notice that there is only one window, and its background is always white. We only use one mouse button and one menu. If you want input other than strings and Booleans, you're out of luck. There are other limitations, but you're starting to get the idea...