Skip to content

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

Notifications You must be signed in to change notification settings

npiegdon/immediate2d

Repository files navigation

Immediate2D Drawing Framework

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.


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

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published