Skip to content

skapaflow/Winpixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Winpixel

Windows-only 2D graphics library in C, built as a DLL. Personal toolbox for rapid prototyping — not production-ready, just a fast way to get a window with drawing on screen.

Work in progress. Expect rough edges and missing features.

Requirements

Build

cd src
make

Produces winpixel.dll and winpixel.lib in src/.

Usage

#include "winpixel.h"

Compile and link against the DLL:

clang your_program.c -o your_program.exe -I path/to/src -L path/to/src -lwinpixel

Make sure winpixel.dll is next to the executable (or on PATH) at runtime.

Minimal example

#include "winpixel.h"

int main() {
    winpixel_window("Hello", 800, 600, false);

    while (wpx_quit && !wpx_key_down(VK_ESCAPE)) {
        wpx_text_center(WHITE, 2, WPX_W2, WPX_H2, "Hello, World!");
        winpixel_render(BLACK, 1);  // present + clear + 1ms delay
    }

    return 0;
}

Features

  • Draw — pixels, lines, rectangles, circles, ellipses, triangles, Bezier curves, splines
  • Sprites — load PNG/BMP via stb_image, draw with scale, flip, or sub-region
  • Text — built-in 6×6 bitmap font, printf-style formatting
  • Input — keyboard (VK_* codes) and mouse (position, buttons, wheel) with press/down/up states
  • Math — lerp, map, clamp, wrap, noise (1D Perlin), distance, direction, color interpolation
  • Time — FPS counter and delta time via QueryPerformanceCounter
  • Colors — 30+ named constants (RED, BLUE, BLUEPRINT, …), Color32 (hex), Colorf (float)

Examples

Pre-built examples are in examples/. To compile them:

# Build the DLL first
cd src && make

# Then build examples
cd examples && make
Example Description
template.exe Minimal starting point
triangle.exe Rotating triangle with mouse interaction and zoom
sprite.exe Sprite loading and drawing
trails.exe Mouse trail effect with color interpolation

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors