Compare commits
13 commits
raylib/v0.
...
master
Author | SHA1 | Date | |
---|---|---|---|
1468af2636 | |||
d63f1b19df | |||
45473d7240 | |||
3df816e2bf | |||
d707d9e51c | |||
bc3da009ef | |||
|
eddd038123 | ||
|
6039070d78 | ||
|
9a87dd6d60 | ||
|
7e9246c069 | ||
|
5d704708c4 | ||
|
3327fcaf9f | ||
|
e08c4cd054 |
210 changed files with 15988 additions and 23827 deletions
143
.github/workflows/build.yml
vendored
143
.github/workflows/build.yml
vendored
|
@ -1,143 +0,0 @@
|
||||||
on: [push, pull_request]
|
|
||||||
name: Build
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install package
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -y; sudo apt-get -y install libxi-dev libxinerama-dev libxcursor-dev libxrandr-dev libgl1-mesa-dev libwayland-dev libxkbcommon-dev
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
- name: Build
|
|
||||||
run: go build ./...
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Verify dependencies
|
|
||||||
run: go mod verify
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Build
|
|
||||||
run: go build -v ./...
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Run go vet
|
|
||||||
run: go vet ./...
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Install staticcheck
|
|
||||||
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Run staticcheck
|
|
||||||
run: staticcheck ./...
|
|
||||||
working-directory: raylib
|
|
||||||
- name: Run tests
|
|
||||||
run: go test -race -vet=off ./...
|
|
||||||
working-directory: raylib
|
|
||||||
|
|
||||||
test-drm:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install package
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -y; sudo apt-get -y install libegl1-mesa-dev libdrm-dev libgbm-dev
|
|
||||||
- name: Build
|
|
||||||
run: go build -tags drm
|
|
||||||
working-directory: raylib
|
|
||||||
|
|
||||||
test-sdl:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install package
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -y; sudo apt-get -y install libgl1-mesa-dev libsdl2-dev
|
|
||||||
- name: Build
|
|
||||||
run: go build -tags sdl
|
|
||||||
working-directory: raylib
|
|
||||||
|
|
||||||
test-rgfw:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install package
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -y; sudo apt-get -y install libxi-dev libxinerama-dev libxcursor-dev libxrandr-dev libgl1-mesa-dev libxkbcommon-dev
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
- name: Build
|
|
||||||
run: go build -tags rgfw
|
|
||||||
working-directory: raylib
|
|
||||||
|
|
||||||
test-purego:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Build
|
|
||||||
run: go build
|
|
||||||
working-directory: raylib
|
|
||||||
env:
|
|
||||||
GOOS: windows
|
|
||||||
|
|
||||||
test-examples:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go-version: [1.21.x]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go-version }}
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Install package
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -y; sudo apt-get -y install libxi-dev libxinerama-dev libxcursor-dev libxrandr-dev libgl1-mesa-dev libwayland-dev libxkbcommon-dev
|
|
||||||
- name: Build
|
|
||||||
run: go build ./...
|
|
||||||
working-directory: examples
|
|
31
README.md
31
README.md
|
@ -1,12 +1,14 @@
|
||||||

|

|
||||||
## raylib-go
|
## raylib-go
|
||||||
[](https://github.com/gen2brain/raylib-go/actions)
|
[](https://git.terah.dev/UnrealXR/raylib-go/actions)
|
||||||
[](https://godoc.org/github.com/gen2brain/raylib-go/raylib)
|
[](https://godoc.org/git.terah.dev/UnrealXR/raylib-go/raylib)
|
||||||
[](https://goreportcard.com/report/github.com/gen2brain/raylib-go/raylib)
|
[](https://goreportcard.com/report/git.terah.dev/UnrealXR/raylib-go/raylib)
|
||||||
[](https://github.com/gen2brain/raylib-go/tree/master/examples)
|
[](https://git.terah.dev/UnrealXR/raylib-go/src/branch/master/examples)
|
||||||
|
|
||||||
Golang bindings for [raylib](http://www.raylib.com/), a simple and easy-to-use library to enjoy videogames programming.
|
Golang bindings for [raylib](http://www.raylib.com/), a simple and easy-to-use library to enjoy videogames programming.
|
||||||
|
|
||||||
|
This is a fork of [gen2brain's `raylib-go` bindings](https://github.com/gen2brain/raylib-go) to add [DRM leasing](https://wayland.app/protocols/drm-lease-v1) support.
|
||||||
|
|
||||||
raylib C source code is included and compiled together with bindings. Note that the first build can take a few minutes.
|
raylib C source code is included and compiled together with bindings. Note that the first build can take a few minutes.
|
||||||
|
|
||||||
It is also possible to use raylib-go without cgo (Windows only; see requirements below).
|
It is also possible to use raylib-go without cgo (Windows only; see requirements below).
|
||||||
|
@ -43,15 +45,22 @@ It is also possible to build the DLL yourself. You can find more info at [raylib
|
||||||
|
|
||||||
##### Android
|
##### Android
|
||||||
|
|
||||||
[Android example](https://github.com/gen2brain/raylib-go/tree/master/examples/others/android/example).
|
[Android example](https://git.terah.dev/UnrealXR/raylib-go/tree/master/examples/others/android/example).
|
||||||
|
|
||||||
|
##### Wasm
|
||||||
|
|
||||||
|
For web bindings, refer to [Raylib-Go-Wasm](https://github.com/BrownNPC/Raylib-Go-Wasm); it should be largely compatible with this repository.
|
||||||
|
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
go get -v -u github.com/gen2brain/raylib-go/raylib
|
go get -v -u git.terah.dev/UnrealXR/raylib-go/raylib
|
||||||
|
|
||||||
### Build tags
|
### Build tags
|
||||||
|
|
||||||
* `drm` - build for Linux native [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) mode, including Raspberry Pi 4 and other devices (PLATFORM_DRM)
|
* `drm` - build for Linux native [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) mode, including Raspberry Pi 4 and other devices (PLATFORM_DRM)
|
||||||
|
* `drm_disable_input` - disables keyboard input capabilities for the DRM backend. Requires the `drm` build tag as a prerequisite
|
||||||
|
* `drm_leasing` - enables Wayland DRM leasing capabilties. Requires the `drm` build tag as a prerequisite
|
||||||
* `sdl` - build for [SDL](https://github.com/libsdl-org/SDL) backend (PLATFORM_DESKTOP_SDL)
|
* `sdl` - build for [SDL](https://github.com/libsdl-org/SDL) backend (PLATFORM_DESKTOP_SDL)
|
||||||
* `sdl3` - build for [SDL3](https://github.com/libsdl-org/SDL) backend (PLATFORM_DESKTOP_SDL3)
|
* `sdl3` - build for [SDL3](https://github.com/libsdl-org/SDL) backend (PLATFORM_DESKTOP_SDL3)
|
||||||
* `rgfw` - build for [RGFW](https://github.com/ColleagueRiley/RGFW) backend (PLATFORM_DESKTOP_RGFW)
|
* `rgfw` - build for [RGFW](https://github.com/ColleagueRiley/RGFW) backend (PLATFORM_DESKTOP_RGFW)
|
||||||
|
@ -66,14 +75,14 @@ It is also possible to build the DLL yourself. You can find more info at [raylib
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
Documentation on [GoDoc](https://godoc.org/github.com/gen2brain/raylib-go/raylib). Also check raylib [cheatsheet](http://www.raylib.com/cheatsheet/cheatsheet.html). If you have problems or need assistance there is an active community in the #raylib-go channel of the [Raylib Discord Server](https://discord.gg/raylib) that can help.
|
Documentation on [GoDoc](https://godoc.org/git.terah.dev/UnrealXR/raylib-go/raylib). Also check raylib [cheatsheet](http://www.raylib.com/cheatsheet/cheatsheet.html). If you have problems or need assistance there is an active community in the #raylib-go channel of the [Raylib Discord Server](https://discord.gg/raylib) that can help.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rl.InitWindow(800, 450, "raylib [core] example - basic window")
|
rl.InitWindow(800, 450, "raylib [core] example - basic window")
|
||||||
|
@ -92,7 +101,7 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Check more [examples](https://github.com/gen2brain/raylib-go/tree/master/examples) organized by raylib modules.
|
Check more [examples](https://git.terah.dev/UnrealXR/raylib-go/tree/master/examples) organized by raylib modules.
|
||||||
|
|
||||||
### Cross-compile (Linux)
|
### Cross-compile (Linux)
|
||||||
|
|
||||||
|
@ -122,4 +131,4 @@ basic_window: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
raylib-go is licensed under an unmodified zlib/libpng license. View [LICENSE](https://github.com/gen2brain/raylib-go/blob/master/LICENSE).
|
raylib-go is licensed under an unmodified zlib/libpng license. View [LICENSE](https://git.terah.dev/UnrealXR/raylib-go/blob/master/LICENSE).
|
||||||
|
|
BIN
assets/raylib-go_256x256.png
Normal file
BIN
assets/raylib-go_256x256.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
|
@ -1,4 +1,4 @@
|
||||||
## easings [](https://godoc.org/github.com/gen2brain/raylib-go/easings)
|
## easings [](https://godoc.org/git.terah.dev/UnrealXR/raylib-go/easings)
|
||||||
|
|
||||||
Useful easing functions for values animation.
|
Useful easing functions for values animation.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module github.com/gen2brain/raylib-go/easings
|
module git.terah.dev/UnrealXR/raylib-go/easings
|
||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxCircles = 64
|
const maxCircles = 64
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rl.InitWindow(800, 450, "raylib [audio] example - music playing (streaming)")
|
rl.InitWindow(800, 450, "raylib [audio] example - music playing (streaming)")
|
||||||
rl.InitAudioDevice()
|
rl.InitAudioDevice()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 800
|
screenWidth = 800
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - 2d camera mouse zoom
|
* raylib [core] example - 2d camera mouse zoom
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 800
|
screenWidth = 800
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const colorCount = 23
|
const colorCount = 23
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/gen2brain/raylib-go/raylib"
|
import "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rl.SetConfigFlags(rl.FlagVsyncHint)
|
rl.SetConfigFlags(rl.FlagVsyncHint)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const screenW = int32(1280)
|
const screenW = int32(1280)
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rl.InitWindow(800, 450, "raylib [core] example - color selection (collision detection)")
|
rl.InitWindow(800, 450, "raylib [core] example - color selection (collision detection)")
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
|
|
|
@ -31,7 +31,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
screenWidth := int32(800)
|
screenWidth := int32(800)
|
||||||
screenHeight := int32(450)
|
screenHeight := int32(450)
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
maxGestureStrings int = 20
|
maxGestureStrings int = 20
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
screenWidth := int32(800)
|
screenWidth := int32(800)
|
||||||
screenHeight := int32(450)
|
screenHeight := int32(450)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const screenW = int32(1280)
|
const screenW = int32(1280)
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -15,7 +15,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -16,7 +16,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 850
|
screenWidth = 850
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/easings"
|
"git.terah.dev/UnrealXR/raylib-go/easings"
|
||||||
"github.com/gen2brain/raylib-go/raygui"
|
"git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,8 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -2,7 +2,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
|
||||||
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Game settings
|
// Game settings
|
||||||
|
@ -60,7 +61,6 @@ func CheckCollisionSide(ball Ball, paddle Paddle) string {
|
||||||
return "none"
|
return "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialize the game state
|
// Initialize the game state
|
||||||
func (g *Game) Init() {
|
func (g *Game) Init() {
|
||||||
g.paddle1 = Paddle{
|
g.paddle1 = Paddle{
|
||||||
|
@ -127,7 +127,6 @@ func (g *Game) Update() {
|
||||||
g.ball.Pos.X = g.paddle2.Pos.X - g.ball.Radius
|
g.ball.Pos.X = g.paddle2.Pos.X - g.ball.Radius
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Scoring
|
// Scoring
|
||||||
if g.ball.Pos.X < 0 {
|
if g.ball.Pos.X < 0 {
|
||||||
g.player2Score++
|
g.player2Score++
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
snakeLength = 256
|
snakeLength = 256
|
||||||
squareSize = 31
|
squareSize = 31
|
||||||
|
|
|
@ -2,19 +2,19 @@ module examples
|
||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
replace github.com/gen2brain/raylib-go/raylib => ../raylib
|
replace git.terah.dev/UnrealXR/raylib-go/raylib => ../raylib
|
||||||
|
|
||||||
replace github.com/gen2brain/raylib-go/raygui => ../raygui
|
replace git.terah.dev/UnrealXR/raylib-go/raygui => ../raygui
|
||||||
|
|
||||||
replace github.com/gen2brain/raylib-go/easings => ../easings
|
replace git.terah.dev/UnrealXR/raylib-go/easings => ../easings
|
||||||
|
|
||||||
replace github.com/gen2brain/raylib-go/physics => ../physics
|
replace git.terah.dev/UnrealXR/raylib-go/physics => ../physics
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gen2brain/raylib-go/easings v0.0.0-00010101000000-000000000000
|
git.terah.dev/UnrealXR/raylib-go/easings v0.0.0-00010101000000-000000000000
|
||||||
github.com/gen2brain/raylib-go/physics v0.0.0-00010101000000-000000000000
|
git.terah.dev/UnrealXR/raylib-go/physics v0.0.0-00010101000000-000000000000
|
||||||
github.com/gen2brain/raylib-go/raygui v0.0.0-00010101000000-000000000000
|
git.terah.dev/UnrealXR/raylib-go/raygui v0.0.0-00010101000000-000000000000
|
||||||
github.com/gen2brain/raylib-go/raylib v0.0.0-20241202103652-5d50abe7c65b
|
git.terah.dev/UnrealXR/raylib-go/raylib v0.0.0-20241202103652-5d50abe7c65b
|
||||||
github.com/jakecoffman/cp v1.2.1
|
github.com/jakecoffman/cp v1.2.1
|
||||||
github.com/neguse/go-box2d-lite v0.0.0-20170921151050-5d8ed9b7272b
|
github.com/neguse/go-box2d-lite v0.0.0-20170921151050-5d8ed9b7272b
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
gui "github.com/gen2brain/raylib-go/raygui"
|
gui "git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
gui "github.com/gen2brain/raylib-go/raygui"
|
gui "git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raygui"
|
"git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
gui "github.com/gen2brain/raylib-go/raygui"
|
gui "git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
gui "github.com/gen2brain/raylib-go/raygui"
|
gui "git.terah.dev/UnrealXR/raylib-go/raygui"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
********************************************************************************************/package main
|
********************************************************************************************/package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 800
|
screenWidth = 800
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
*
|
*
|
||||||
* raylib [models] example - first person maze
|
* raylib [models] example - first person maze
|
||||||
*
|
*
|
||||||
* This example has been created using raylib-go v0.0.0-20220104071325-2f072dc2d259 (https://github.com/gen2brain/raylib-go)
|
* This example has been created using raylib-go v0.0.0-20220104071325-2f072dc2d259 (https://git.terah.dev/UnrealXR/raylib-go)
|
||||||
* raylib-go is licensed under an unmodified zlib/libpng license (https://github.com/gen2brain/raylib-go/blob/master/LICENSE)
|
* raylib-go is licensed under an unmodified zlib/libpng license (https://git.terah.dev/UnrealXR/raylib-go/blob/master/LICENSE)
|
||||||
*
|
*
|
||||||
* Original C version for Raylib 2.5 Copyright (c) 2019 Ramon Santamaria (@raysan5)
|
* Original C version for Raylib 2.5 Copyright (c) 2019 Ramon Santamaria (@raysan5)
|
||||||
* Converted to Go by Michael Redman January 4, 2022
|
* Converted to Go by Michael Redman January 4, 2022
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
screenWidth := int32(800)
|
screenWidth := int32(800)
|
||||||
screenHeight := int32(450)
|
screenHeight := int32(450)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
//"fmt"
|
//"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -122,7 +122,7 @@ func main() {
|
||||||
cursorColor := rl.White
|
cursorColor := rl.White
|
||||||
|
|
||||||
// Get ray and test against objects
|
// Get ray and test against objects
|
||||||
// See issue : https://github.com/gen2brain/raylib-go/issues/457
|
// See issue : https://git.terah.dev/UnrealXR/raylib-go/issues/457
|
||||||
//ray = rl.GetScreenToWorldRay(rl.GetMousePosition(), camera)
|
//ray = rl.GetScreenToWorldRay(rl.GetMousePosition(), camera)
|
||||||
ray = rl.GetMouseRay(rl.GetMousePosition(), camera)
|
ray = rl.GetMouseRay(rl.GetMousePosition(), camera)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
var supportedFileTypes = []string{
|
var supportedFileTypes = []string{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "github.com/gen2brain/raylib-go/raylib"
|
import rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
screenWidth = 800
|
screenWidth = 800
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Game states
|
// Game states
|
||||||
|
|
|
@ -3,9 +3,13 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This is the maximum amount of elements (quads) per batch
|
||||||
|
// NOTE: This value is defined in [rlgl] module and can be changed there
|
||||||
|
const maxBatchElements = 8192
|
||||||
|
|
||||||
// Bunny type
|
// Bunny type
|
||||||
type Bunny struct {
|
type Bunny struct {
|
||||||
Position rl.Vector2
|
Position rl.Vector2
|
||||||
|
@ -14,15 +18,14 @@ type Bunny struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
screenWidth := int32(1280)
|
screenWidth := int32(800)
|
||||||
screenHeight := int32(960)
|
screenHeight := int32(450)
|
||||||
|
|
||||||
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - Bunnymark")
|
rl.InitWindow(screenWidth, screenHeight, "raylib [others] example - bunnymark")
|
||||||
|
|
||||||
texture := rl.LoadTexture("wabbit_alpha.png")
|
texture := rl.LoadTexture("wabbit_alpha.png")
|
||||||
|
|
||||||
bunnies := make([]*Bunny, 0)
|
bunnies := make([]*Bunny, 0)
|
||||||
bunniesCount := 0
|
|
||||||
|
|
||||||
rl.SetTargetFPS(60)
|
rl.SetTargetFPS(60)
|
||||||
|
|
||||||
|
@ -33,11 +36,11 @@ func main() {
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
b := &Bunny{}
|
b := &Bunny{}
|
||||||
b.Position = rl.GetMousePosition()
|
b.Position = rl.GetMousePosition()
|
||||||
b.Speed.X = float32(rl.GetRandomValue(250, 500)) / 60.0
|
b.Speed.X = float32(rl.GetRandomValue(-250, 250)) / 60.0
|
||||||
b.Speed.Y = float32(rl.GetRandomValue(250, 500)-500) / 60.0
|
b.Speed.Y = float32(rl.GetRandomValue(-250, 250)) / 60.0
|
||||||
|
b.Color = rl.NewColor(uint8(rl.GetRandomValue(50, 240)), uint8(rl.GetRandomValue(80, 240)), uint8(rl.GetRandomValue(100, 240)), 255)
|
||||||
|
|
||||||
bunnies = append(bunnies, b)
|
bunnies = append(bunnies, b)
|
||||||
bunniesCount++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +49,11 @@ func main() {
|
||||||
b.Position.X += b.Speed.X
|
b.Position.X += b.Speed.X
|
||||||
b.Position.Y += b.Speed.Y
|
b.Position.Y += b.Speed.Y
|
||||||
|
|
||||||
if (b.Position.X > float32(screenWidth)) || (b.Position.X < 0) {
|
if ((b.Position.X + float32(texture.Width/2)) > float32(screenWidth)) || ((b.Position.X + float32(texture.Width/2)) < 0) {
|
||||||
b.Speed.X *= -1
|
b.Speed.X *= -1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.Position.Y > float32(screenHeight)) || (b.Position.Y < 0) {
|
if ((b.Position.Y + float32(texture.Height/2)) > float32(screenHeight)) || ((b.Position.Y + float32(texture.Height/2-40)) < 0) {
|
||||||
b.Speed.Y *= -1
|
b.Speed.Y *= -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,18 +63,20 @@ func main() {
|
||||||
rl.ClearBackground(rl.RayWhite)
|
rl.ClearBackground(rl.RayWhite)
|
||||||
|
|
||||||
for _, b := range bunnies {
|
for _, b := range bunnies {
|
||||||
// NOTE: When internal QUADS batch limit is reached, a draw call is launched and
|
// NOTE: When internal batch buffer limit is reached (MAX_BATCH_ELEMENTS),
|
||||||
// batching buffer starts being filled again; before launching the draw call,
|
// a draw call is launched and buffer starts being filled again;
|
||||||
// updated vertex data from internal buffer is send to GPU... it seems it generates
|
// before issuing a draw call, updated vertex data from internal CPU buffer is send to GPU...
|
||||||
// a stall and consequently a frame drop, limiting number of bunnies drawn at 60 fps
|
// Process of sending data is costly and it could happen that GPU data has not been completely
|
||||||
rl.DrawTexture(texture, int32(b.Position.X), int32(b.Position.Y), rl.RayWhite)
|
// processed for drawing while new data is tried to be sent (updating current in-use buffers)
|
||||||
|
// it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies
|
||||||
|
rl.DrawTexture(texture, int32(b.Position.X), int32(b.Position.Y), b.Color)
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.DrawRectangle(0, 0, screenWidth, 40, rl.LightGray)
|
rl.DrawRectangle(0, 0, screenWidth, 40, rl.Black)
|
||||||
rl.DrawText("raylib bunnymark", 10, 10, 20, rl.DarkGray)
|
rl.DrawText(fmt.Sprintf("bunnies: %d", len(bunnies)), 120, 10, 20, rl.Green)
|
||||||
rl.DrawText(fmt.Sprintf("bunnies: %d", bunniesCount), 400, 10, 20, rl.Red)
|
rl.DrawText(fmt.Sprintf("batched draw calls: %d", 1+len(bunnies)/maxBatchElements), 320, 10, 20, rl.Maroon)
|
||||||
|
|
||||||
rl.DrawFPS(260, 10)
|
rl.DrawFPS(10, 10)
|
||||||
|
|
||||||
rl.EndDrawing()
|
rl.EndDrawing()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,8 +4,6 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
|
|
||||||
box2d "github.com/neguse/go-box2d-lite/box2dlite"
|
box2d "github.com/neguse/go-box2d-lite/box2dlite"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
"github.com/jakecoffman/cp"
|
"github.com/jakecoffman/cp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/physics"
|
"git.terah.dev/UnrealXR/raylib-go/physics"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/physics"
|
"git.terah.dev/UnrealXR/raylib-go/physics"
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/physics"
|
"git.terah.dev/UnrealXR/raylib-go/physics"
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/physics"
|
"git.terah.dev/UnrealXR/raylib-go/physics"
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
"git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gen2brain/raylib-go/physics"
|
"git.terah.dev/UnrealXR/raylib-go/physics"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LightType int32
|
type LightType int32
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LightType int32
|
type LightType int32
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MAX_INSTANCES = 100000
|
const MAX_INSTANCES = 100000
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -2,8 +2,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LightType int32
|
type LightType int32
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxPostproShaders = 12
|
const MaxPostproShaders = 12
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
screenWidth := int32(800)
|
screenWidth := int32(800)
|
||||||
screenHeight := int32(450)
|
screenHeight := int32(450)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
rl "github.com/gen2brain/raylib-go/raylib"
|
rl "git.terah.dev/UnrealXR/raylib-go/raylib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue