Golang bindings for raylib, a simple and easy-to-use library to learn videogames programming.
-
OpenAL Soft NOTE: if you don't need audio you can use
-tags noaudio
during build, OpenAL will not be linked to binary, though none of the audio functions will be available. -
GLFW is included as part of the Go package, but you need to make sure you have dependencies installed, see below.
apt-get install libopenal-dev libgl1-mesa-dev libxi-dev libxinerama-dev libxcursor-dev libxxf86vm-dev libxrandr-dev
dnf install openal-soft-devel mesa-libGL-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel
On OS X system OpenAL framework is used, you need Xcode or Command Line Tools for Xcode.
Windows (MSYS2)
pacman -S mingw-w64-x86_64-openal mingw-w64-x86_64-gcc mingw-w64-x86_64-go git
On Windows, build binary in MSYS2 shell.
go get -v -u github.com/gen2brain/raylib-go/raylib
noaudio
- disables audio functions and doesn't link against OpenAL librariesopengl21
- 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 librariesstatic
- links against OpenAL static 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.