Skip to main content

C

Hello rectangle!

hello_rectangle.c
#define USING_NAMESPACE_P8G
#include "p8g.h"

void draw() {
background(220);
rect(50, 50, 100, 100);
}

void keyPressed() {}
void keyReleased() {}
void mouseMoved() {}
void mousePressed() {}
void mouseReleased() {}
void mouseWheel(float delta) {}

int main() {
run(320, 320, "Hello rectangle!");
}
ScreenshotScreenshot

Build and run from the command line

.
├── glfw.dll
├── hello_rectangle.c
├── p8g.dll
└── p8g.h
gcc hello_rectangle.c -L. -lp8g
.\a.exe

Tested on Windows 10 with https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z extracted to C:\Program Files and C:\Program Files\mingw64\bin added to PATH environment variable.