Golang bindings for raylib, a simple and easy-to-use library to learn videogames programming.
- GLFW is included as part of the Go package, but you need to make sure you have dependencies installed, see below.
apt-get install libasound2-dev libgl1-mesa-dev libxi-dev libxinerama-dev libxcursor-dev libxxf86vm-dev libxrandr-dev
dnf install alsa-lib-devel mesa-libGL-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel
On macOS you need Xcode or Command Line Tools for Xcode.
On Windows you need C compiler, like Mingw-w64 or TDM-GCC. You can also build binary in MSYS2 shell.
go get -v -u github.com/gen2brain/raylib-go/raylib
noaudio
- disables audio functionsopengl21
- uses OpenGL 2.1 backend (default is 3.3 on desktop)opengl11
- uses OpenGL 1.1 backend (pseudo OpenGL 1.1 style)wayland
- builds against Wayland libraries
Documentation on GoDoc. Also check raylib cheatsheet.
package main
import "github.com/gen2brain/raylib-go/raylib"
func main() {
raylib.InitWindow(800, 450, "raylib [core] example - basic window")
raylib.SetTargetFPS(60)
for !raylib.WindowShouldClose() {
raylib.BeginDrawing()
raylib.ClearBackground(raylib.RayWhite)
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LightGray)
raylib.EndDrawing()
}
raylib.CloseWindow()
}
Check more examples organized by raylib modules.
raylib-go is licensed under an unmodified zlib/libpng license. View LICENSE.