-
Notifications
You must be signed in to change notification settings - Fork 0
getting started
github-actions[bot] edited this page Aug 29, 2026
·
2 revisions
Copyright (c) 2024-2026 Jack Waechter. MIT licensed.
AP2 is Application Primitives: one header and a small C17 library. This page gets a window on screen.
- CMake 3.15 or newer
- A C17 compiler (GCC, Clang, or MSVC)
- Python 3, once, so CMake can generate the GLAD OpenGL loader
- cforge is optional; plain CMake works
On Windows, MSYS2 UCRT (C:/msys64/ucrt64/bin/gcc.exe) matches cforge.toml.
From the repo root:
python ap2_product.py
cforge runOr:
cmake -B build -G "Ninja Multi-Config"
cmake --build build --config Debug
./build/bin/Debug/ap2src/main.c is a sample 3D program (orbit camera, lights, meshes).
Create a .c file and include the umbrella header:
#include <AP2/AP2.h>
int main(void) {
if (!AP_Init(AP_INIT_VIDEO)) {
return 1;
}
if (!AP_CreateWindow("AP2", 1280, 720, AP_WINDOW_RESIZABLE)) {
AP_Quit();
return 1;
}
while (AP_IsRunning()) {
AP_PumpEvents();
AP_Tick();
if (AP_IsKeyPressed(AP_KEY_ESCAPE)) {
AP_RequestClose();
}
AP_SetDrawColor(0.08f, 0.09f, 0.11f, 1.0f);
AP_Clear();
AP_SetDrawColor(0.95f, 0.35f, 0.35f, 1.0f);
AP_FillRect(&(AP_FRect){80.0f, 80.0f, 240.0f, 140.0f});
AP_Present();
}
AP_DestroyWindow(NULL);
AP_Quit();
return 0;
}AP_INIT_VIDEO also brings up windowing. Add | AP_INIT_AUDIO when you need the mixer.
Application code should use the short macros:
| You write | Underlying call |
|---|---|
AP_SetDrawColor |
AP_SetRenderDrawColorFloat |
AP_Clear |
AP_RenderClear |
AP_Present |
AP_RenderPresent |
AP_FillRect |
AP_RenderFillRect |
AP_FillCircleF |
AP_RenderFillCircle |
AP_DrawLineF |
AP_RenderLine |
AP_DrawTexture |
AP_RenderTexture |
AP_DrawSprite |
AP_RenderSprite |
AP_DrawTilemap |
AP_RenderTilemap |
AP_DrawText |
AP_RenderText |
AP_PushTransform |
AP_PushRenderTransform |
Both names work. Tutorials in this tree use the left column.
- 2D / GUI / text: top-left origin, Y down, units are window pixels.
- 3D / math / spatial audio: right-handed, Y up (OpenGL world).
- Architecture — subsystems and modules
- Hello window — the loop in more detail
- Drawing in 2D — shapes and color
AP2 — Application Primitives. MIT licensed. Copyright (c) 2024-2026 Jack Waechter. Generated from docs/ in the repository.
- Home
- Guides
- Tutorials
- Tutorial 01 — Hello window
- Tutorial 02 — Drawing in 2D
- Tutorial 03 — Textures and sprites
- Tutorial 04 — Input
- Tutorial 05 — Audio
- Tutorial 06 — Text and fonts
- Tutorial 07 — Immediate GUI
- Tutorial 08 — 3D
- Tutorial 09 — Shaders and post-processing
- Tutorial 10 — Breakout
- Tutorial 11 — Top-down walker
- Tutorial 12 — Desktop tool
- Tutorial 13 — Tilemaps
- Tutorial 14 — Advanced 3D: A PBR Product Scene
- Tutorial 15 — Advanced GUI: A Retained-Mode Desktop App
- Tutorial 16 — Camera Rigs and Cinematic Post-Processing
- Tutorial 17 — Capstone: A Complete Application