Rye-Raylib brings the power of raylib graphics library to the Rye programming language. Build cross-platform games, visualizations, and graphics applications with Rye's expressive syntax and raylib's simple yet powerful API.
You need Go installed on your system, along with raylib development dependencies.
# Clone the repository
git clone https://github.com/refaktor/rye-raylib.git
cd rye-raylib
# Generate bindings (if needed)
go tool ryegen
# Build the project
go build
# Run an example
./rye-raylib examples/ball.rye; Basic raylib window
rl: import\go "raylib"
rl/init-window 600 450 "raylib - Hello from Rye!"
rl/set-target-fps 60
while { not rl/window-should-close } {
rl/begin-drawing
rl/clear-background rl/ray-white?
rl/draw-text "Ryelang + Raylib <3" 190 200 20 rl/red?
rl/end-drawing
}
rl/close-window
; Bouncing ball animation
rl: import\go "raylib"
screen-width: 800
screen-height: 600
var 'x 400.0
var 'y 300.0
var 'dx 5.0
var 'dy 3.0
radius: 20.0
rl/init-window screen-width screen-height "Bouncing Ball - Rye + Raylib"
rl/set-target-fps 60
while { not rl/window-should-close } {
; Update position
change! x + dx 'x
change! y + dy 'y
; Bounce off walls
if x < radius { change! negate dx 'dx }
if x > ( screen-width - radius ) { change! negate dx 'dx }
if y < radius { change! negate dy 'dy }
if y > ( screen-height - radius ) { change! negate dy 'dy }
; Draw
rl/begin-drawing
rl/clear-background rl/ray-white?
rl/draw-circle x .integer y .integer radius rl/red?
rl/draw-fps 10 10
rl/end-drawing
}
rl/close-window
## Interactive Development
Start the Rye console for interactive graphics development:
```bash
./rye-raylib
; Quick graphics demo in the console
rye> rl: import\go "raylib"
rye> rl/init-window 400 300 "Quick Demo"
rye> rl/set-target-fps 60
rye> loop 100 { rl/begin-drawing rl/clear-background rl/blue? rl/end-drawing }
rye> rl/close-window
- Rye Language - The core Rye language
- Rye Website - Documentation and tutorials
- raylib - raylib official website
- raylib Cheatsheet - Quick reference for raylib functions
- raylib-go - Go bindings for raylib
- Reddit Community - Join the discussion
This project is open source under the Apache License 2.0. See the LICENSE file for details.