Blog

Win32 C++ pixel playground template

A tiny Win32 starter that cross-compiles from Linux with MinGW-w64 + Meson, opens a window, and pushes pixels through a software framebuffer.

13 November 2022 · C++, Win32, Meson, Graphics

Why #

I wanted a zero-dependency starting point for Win32 experiments: open a window, draw pixels in software, and measure each frame without pulling in a game engine or DirectX. The template now ships with a Meson-only workflow that cross-compiles on Linux (MinGW-w64) and runs under Wine.

What’s inside #

How to build/run (Linux host → Windows target) #

Install prerequisites (Debian/Ubuntu example):

sudo apt-get install mingw-w64 ninja-build meson wine64

Meson + Ninja:

meson setup build-mingw --cross-file cross/windows-mingw64.txt --buildtype=release
ninja -C build-mingw
wine build-mingw/cpp_playground.exe

From VS Code: press F5 and choose Run with Wine (Meson); the default build task runs meson:build-mingw and launches the resulting binary via Wine.

What happens when it runs #

A window appears, the client area is cleared to dark gray, and a color gradient is drawn via the software framebuffer each frame. WinProc also paints a simple “Hello Team” text on WM_PAINT, giving a spot to extend message handling for input or UI.

Takeaways #