/immediate2d

A C++ drawing framework for Windows that makes simple graphics programming as fun and easy as the days when computers booted directly to a BASIC prompt

Primary LanguageC++

Immediate2D Drawing Framework

A C++ drawing framework for Windows that makes simple graphics programming as fun and easy as the days when computers booted directly to a BASIC prompt.

Made for beginners and classrooms. To use this framework just drop "drawing.cpp" and "drawing.h" into a new "Win32" Visual Studio project and declare a void main() function. 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 main() {
  SetPixel(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.


Example 1 - Hellow World

A one-line example with exercises to familiarize the student with the "y goes down" computer graphics convention.

Example 1


Example 2 - Blink

Demonstrates simple animation in a while loop.

Example 2


Example 3 - Button

Shows a little bit of mouse interaction and uses the exercises to build up some rudimentary UI concepts.

Example 3


Example 4 - Paint

More mouse interaction through a simple paint example.

Example 4


Example 5 - Graphing

A graphing calculator in 8 lines of code.

Example 5


Example 6 - Text

Demonstrates how little you really need to do something like draw text to the screen (by packing each glyph into a single int).

Example 6


Example 7 - Nibbles

An adaptation of the classic NIBBLES.BAS snake game example that was included with QBASIC.

Example 7


Example 8 - Smoke

An implementation of Joe Stam's 2003 paper "Real-Time Fluid Dynamics for Games" that fits in about 250 lines of C++.

Example 8


Example 9 - Raytracer

An adaptation of Kevin Beason's smallpt ray tracer.

Example 9