A Roc platform for creating simple native graphics applications and games, built on raylib.
RocRay is an experimental platform that supports research and development of the Roc compiler. Its aim is to make simple games that demonstrate the benefits of the Roc language and of platform development. We expect the ideas here to be expanded in future, and contributions are welcome.
The goal isn't to build or support a large game engine. We're happy to help where it advances those aims — see CONTRIBUTING.md if you'd like to get involved.
Work in Progress: This platform targets the new Roc compiler and Zig 0.16. Expect breaking changes and incomplete functionality.
Performance: For the best performance, run your app with
roc build(e.g.roc build examples/breakout.roc) rather thanroc <file>.roc builduses the optimised LLVM backend, while running directly uses the in-development backends. This is expected to be a temporary limitation while the dev backends mature.
- 2D drawing primitives (styled rectangles, rounded rectangles, circles, lines, triangles, polygons, gradients, text)
- Asset loading for host-owned textures, with source/destination rectangles, rotation, origin, scale, and tint
- Pure 2D camera values with scoped world-space drawing
- Sprite helpers for spritesheet frames and simple frame-rate-based animation
- 2D math and collision helpers (Vec2, Rect, Circle, clamp, lerp, normalize, contains, overlaps)
- Tiled TMX tilemap loading, drawing, layer/object roles, solid queries, and object/property access
- Physics helpers backed by compact 3D PGA points, vectors, planes, lines, and translation motors
- RGBA colors with named constants, RGB/RGBA constructors, and hex helpers
- Explicit FPS/debug text drawing
- Text measurement, alignment helpers, long-string rendering, and custom font loading
- Mouse and keyboard input handling
- Loaded sound effects and generated procedural sounds with volume, pitch, and pan
- Streamed music playback with host-managed per-frame updates
- Native rendering via raylib (macOS, Linux, Windows)
- Zig 0.16.0
- Roc (the pinned compiler commit is in
ci/ROC_COMMIT)
First, build the platform and cross-compile the pre-built host libraries for all supported targets:
zig buildThen build and run the hello world example:
roc build examples/hello_world.roc
./hello_worldUse
roc build(rather thanroc examples/hello_world.roc) for the best performance — see the note above.
Sprite and texture drawing:
roc build examples/sprites.roc
./spritesWorld-space camera drawing:
roc build examples/camera.roc
./cameraBeginner game examples:
roc build examples/snake.roc && ./snake
roc build examples/breakout.roc && ./breakout
roc build examples/top_down.roc && ./top_down
roc build examples/cave_climb.roc && ./cave_climbThe top-down demo uses a Tiled-authored TMX map and selected CC0 assets from Kenney's Topdown Shooter, Impact Sounds, and Music Jingles packs; asset licenses are included under examples/assets/.
The cave climber demonstrates TMX tile layers, object roles, sprite sheets, camera following, and Physics distance checks with selected CC0 assets from Kenney's New Platformer Pack.
| Target | Description |
|---|---|
| x64mac | macOS Intel |
| arm64mac | macOS Apple Silicon |
| x64glibc | Linux x64 |
| x64win | Windows x64 |
- We vendor the pre-compiled libraries from raylib v6.0
- The default Linux bundle uses raylib's X11 build. A separate Linux x64 Wayland bundle can be created with
./bundle.sh --platform waylandafter buildingvendor/raylib/linux-x64-wayland/libraylib.a. - ARM Linux is not available (raylib doesn't provide pre-built libraries)
RocRay exists to push on Roc compiler and platform development, so contributions that serve those aims are very welcome. See CONTRIBUTING.md for how to build the platform, run the test suite, regenerate glue bindings, and bundle a release.
