This code due to Seth Ladd is a shell into which you can build a game.