A C++ drawing framework for Windows that makes simple graphics programming as much fun as the days when computers booted directly to a BASIC prompt.
Made for beginners and classrooms. To use this framework: open Visual Studio, choose "Create a new project", select the "Windows Desktop Wizard" from the list, (give your project a name), choose "Desktop Application (.exe)" from the wizard, and check the "Empty Project" box. Then, add drawing.cpp, drawing.h, and some new cpp file for your own code to the project. Just, declare a void run()
function and Immediate2D will take care of the rest.
There is absolutely zero setup or initialization. (By default you get a 5x scaled-up 160x120 window and can draw to it in your very first line of code:
#include "drawing.h"
void run() {
DrawPixel(80, 20, LightBlue);
}
Includes a nice set of examples with exercises taking a student from drawing a single dot (shown above) all the way to simple games and physics simulations.
Everything you need is documented in drawing.h and a Quick Reference is supplied that fits everything on one page.
Visit the Releases page to download and play with pre-built versions of the examples.
A one-line example with exercises to familiarize the student with the "y goes down" computer graphics convention.
Demonstrates simple animation in a while
loop.
Shows a little bit of mouse interaction and uses the exercises to build up some rudimentary UI concepts.
More mouse interaction through a simple paint example.
A graphing calculator in 8 lines of code.
Demonstrates how little you really need to do something like draw text to the screen (by packing each glyph into a single int).
An adaptation of the classic NIBBLES.BAS snake game example that was included with QBASIC.
An implementation of Joe Stam's 2003 paper "Real-Time Fluid Dynamics for Games" that fits in about 250 lines of C++.
An adaptation of Kevin Beason's smallpt ray tracer.