Skip to main content

C++

Hello rectangle!

hello_rectangle.cpp
#include "p8g.hpp"

using namespace p8g;

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

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

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

Build and run from the command line

.
├── glfw.dll
├── hello_rectangle.cpp
├── p8g++.dll
├── p8g.dll
└── p8g.hpp
g++ -std=c++11 hello_rectangle.cpp -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.