A lightweight creative coding framework based on sokol. Inspired by openFrameworks, implemented simply with modern C++.
- Lightweight: Minimal dependencies, built on sokol
- Header-only: Most features are header-only
- C++20: Leverages modern C++ features
- Cross-platform: macOS 14+ (Metal), Windows (D3D11), Web (WebGPU). Linux/Raspberry Pi planned.
- oF-like API: Familiar design for openFrameworks users
-> See GET_STARTED.md to get up and running!
Build it once from tools/ (run tools/build_mac.command, tools/build_linux.sh, or tools/build_win.bat) to create projects via GUI.
Supports VSCode, Cursor, Xcode, and Visual Studio.
# Build an example
cd examples/graphics/graphicsExample
cmake --preset macos # or: windows, linux, web
cmake --build build-macos --parallel
# Run (macOS)
./bin/graphicsExample.app/Contents/MacOS/graphicsExample#include "TrussC.h"
using namespace std;
using namespace tc;
class MyApp : public App {
void draw() override {
clear(0.1); // Clear to dark gray
setColor(1.0, 0.4, 0.4);
drawCircle(getWindowWidth() / 2, getWindowHeight() / 2, 100);
}
};
int main() {
WindowSettings settings;
settings.setSize(960, 600);
settings.setTitle("My App");
return runApp<MyApp>(settings);
}TrussC comes with over 30 examples covering graphics, 3D, sound, video, and more. See them running in your browser at trussc.org/examples.
Source code is available in the examples/ directory.
Comprehensive API reference is available at trussc.org/reference.
Markdown version is also available in docs/REFERENCE.md.
TrussC uses TAU (τ = 2π) as the primary circle constant instead of PI.
// TAU = one full rotation
rotate(TAU * 0.25f); // Quarter turn (90°)
rotate(TAU * 0.5f); // Half turn (180°)
rotate(TAU); // Full turn (360°)
// PI is deprecated (will emit compiler warning)
rotate(PI); // Warning: Use TAU insteadWhy? TAU maps directly to the unit circle:
TAU * 0.25= quarter turn = 90°TAU * 0.5= half turn = 180°TAU * 0.75= three-quarter turn = 270°TAU= full turn = 360°
With PI, you constantly multiply by 2 for full rotations. TAU eliminates this mental overhead.
PI is still available for compatibility, but marked [[deprecated]] to encourage TAU adoption.
See also: The Tau Manifesto
sokol, stb, miniaudio, etc. are all bundled in core/include/. Dear ImGui is available as the tcxImGui addon.
See LICENSE.md for details.
core/include/
├── TrussC.h # Main header (include this)
├── tcBaseApp.h # App base class
├── tc/ # Feature headers
│ ├── graphics/ # Shapes, images, fonts
│ ├── gpu/ # FBO, shaders, textures
│ ├── 3d/ # 3D transforms, primitives, camera
│ ├── types/ # Color, Vec2/3/4, etc.
│ ├── events/ # Event system
│ ├── math/ # Math utilities, noise
│ ├── sound/ # Audio playback
│ ├── video/ # Video playback, webcam
│ ├── network/ # TCP, UDP
│ └── utils/ # Timer, file dialogs, etc.
├── sokol/ # sokol library
└── stb/ # stb library
examples/ # Example projects
src/ # Platform-specific implementations
- GET_STARTED.md - Getting started guide
- REFERENCE.md - API Reference
- TrussC_vs_openFrameworks.md - API mapping for oF users
- ADDONS.md - How to use addons
- AI_AUTOMATION.md - MCP Integration & Automation
- ARCHITECTURE.md - Design philosophy and architecture
- BUILD_SYSTEM.md - CMake build system details
- ROADMAP.md - Development roadmap
MIT License - See LICENSE.md for details.