Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
Find a file
Milan Nikolic 3c61a95ab0
Update cgo
2023-11-09 09:44:48 +01:00
.github/workflows Update actions 2023-11-07 12:59:35 +01:00
easings Update modules 2022-12-04 12:58:11 +01:00
examples Update Android instructions 2023-11-07 14:58:44 +01:00
physics Update modules 2023-06-21 11:36:35 +02:00
raygui Update C sources 2023-11-04 13:06:19 +01:00
raylib Update cgo 2023-11-09 09:44:48 +01:00
rres Update C sources 2023-11-04 13:06:19 +01:00
.gitignore Update modules 2022-12-04 12:58:11 +01:00
LICENSE Initial commit 2017-01-27 09:35:30 +01:00
README.md Update README.md 2023-11-08 22:24:21 +01:00

logo

raylib-go

Build Status GoDoc Go Report Card Examples

Golang bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

raylib C source code is included and compiled together with bindings. Note that the first build can take a few minutes.

Requirements

Ubuntu
X11
apt-get install libgl1-mesa-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev 
Wayland
apt-get install libgl1-mesa-dev libwayland-dev libxkbcommon-dev 
Fedora
X11
dnf install mesa-libGL-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel
Wayland
dnf install mesa-libGL-devel wayland-devel libxkbcommon-devel
macOS

On macOS you need Xcode or Command Line Tools for Xcode.

Windows

On Windows you need C compiler, like Mingw-w64 or TDM-GCC. You can also build binary in MSYS2 shell.

Android

Android example.

Installation

go get -v -u github.com/gen2brain/raylib-go/raylib

Build tags

  • drm - build for Linux native DRM mode, including Raspberry Pi 4 and other devices (PLATFORM_DRM)
  • sdl - build for SDL backend instead of internal GLFW (PLATFORM_DESKTOP_SDL)
  • wayland - build against Wayland libraries (internal GLFW)
  • noaudio - disables audio functions
  • opengl43 - uses OpenGL 4.3 backend
  • opengl21 - uses OpenGL 2.1 backend (default is 3.3 on desktop)
  • opengl11 - uses OpenGL 1.1 backend (pseudo OpenGL 1.1 style)
  • es2 - uses OpenGL ES 2.0 backend (can be used to link against Google's ANGLE)
  • es3 - experimental support for OpenGL ES 3.0

Documentation

Documentation on GoDoc. Also check raylib cheatsheet.

Example

package main

import rl "github.com/gen2brain/raylib-go/raylib"

func main() {
	rl.InitWindow(800, 450, "raylib [core] example - basic window")
	defer rl.CloseWindow()

	rl.SetTargetFPS(60)

	for !rl.WindowShouldClose() {
		rl.BeginDrawing()

		rl.ClearBackground(rl.RayWhite)
		rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LightGray)

		rl.EndDrawing()
	}
}

Check more examples organized by raylib modules.

License

raylib-go is licensed under an unmodified zlib/libpng license. View LICENSE.