93 lines
3 KiB
Markdown
93 lines
3 KiB
Markdown

|
|
## raylib-go
|
|
[](https://github.com/gen2brain/raylib-go/actions)
|
|
[](https://godoc.org/github.com/gen2brain/raylib-go/raylib)
|
|
[](https://goreportcard.com/report/github.com/gen2brain/raylib-go/raylib)
|
|
[](https://github.com/gen2brain/raylib-go/tree/master/examples)
|
|
|
|
Golang bindings for [raylib](http://www.raylib.com/), a simple and easy-to-use library to enjoy videogames programming.
|
|
|
|
### 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](https://mingw-w64.org) or [TDM-GCC](http://tdm-gcc.tdragon.net/).
|
|
You can also build binary in [MSYS2](https://msys2.github.io/) shell.
|
|
|
|
##### Android
|
|
|
|
[Android example](https://github.com/gen2brain/raylib-go/tree/master/examples/others/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)
|
|
* `angle` - uses OpenGL ES 2.0 backend (can be used to link against [Google's ANGLE](https://github.com/google/angle))
|
|
|
|
### Documentation
|
|
|
|
Documentation on [GoDoc](https://godoc.org/github.com/gen2brain/raylib-go/raylib). Also check raylib [cheatsheet](http://www.raylib.com/cheatsheet/cheatsheet.html).
|
|
|
|
### Example
|
|
|
|
```go
|
|
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](https://github.com/gen2brain/raylib-go/tree/master/examples) organized by raylib modules.
|
|
|
|
|
|
### License
|
|
|
|
raylib-go is licensed under an unmodified zlib/libpng license. View [LICENSE](https://github.com/gen2brain/raylib-go/blob/master/LICENSE).
|