88 lines
3 KiB
Markdown
88 lines
3 KiB
Markdown

|
|
## raylib-go
|
|
[](https://travis-ci.org/gen2brain/raylib-go)
|
|
[](https://ci.appveyor.com/project/gen2brain/raylib-go)
|
|
[](https://godoc.org/github.com/gen2brain/raylib-go/raylib)
|
|
[](https://goreportcard.com/report/github.com/gen2brain/raylib-go)
|
|
[](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 learn videogames programming.
|
|
|
|

|
|
|
|
### Requirements
|
|
|
|
* [GLFW](http://www.glfw.org/) is included as part of the Go package, but you need to make sure you have dependencies installed, see below.
|
|
|
|
##### Ubuntu
|
|
|
|
apt-get install libasound2-dev libgl1-mesa-dev libxi-dev libxinerama-dev libxcursor-dev libxxf86vm-dev libxrandr-dev
|
|
|
|
##### Fedora
|
|
|
|
dnf install alsa-lib-devel mesa-libGL-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel
|
|
|
|
##### macOS
|
|
|
|
On macOS you need Xcode or Command Line Tools for Xcode.
|
|
|
|
##### Windows
|
|
|
|
On Windows you need C compiler, like [https://mingw-w64.org](Mingw-w64) or [http://tdm-gcc.tdragon.net/](TDM-GCC).
|
|
You can also build binary in [MSYS2](https://msys2.github.io/) shell.
|
|
|
|
##### Android
|
|
|
|
[Android example](https://github.com/gen2brain/raylib-go/tree/master/examples/android/example).
|
|
|
|
##### Raspberry Pi
|
|
|
|
[RPi example](https://github.com/gen2brain/raylib-go/tree/master/examples/rpi/basic_window).
|
|
|
|
### Installation
|
|
|
|
go get -v -u github.com/gen2brain/raylib-go/raylib
|
|
|
|
### Build tags
|
|
|
|
* `noaudio` - disables audio functions
|
|
* `opengl21` - 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
|
|
|
|
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 "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](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).
|