Android example can now be built on desktop
This commit is contained in:
parent
56debbf236
commit
e365f75e34
5 changed files with 43 additions and 15 deletions
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"github.com/gen2brain/raylib-go/raylib"
|
||||
|
@ -24,7 +25,11 @@ func run(app unsafe.Pointer) {
|
|||
|
||||
raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
||||
|
||||
raylib.InitWindow(screenWidth, screenHeight, app)
|
||||
if runtime.GOOS != "android" {
|
||||
raylib.InitWindow(screenWidth, screenHeight, "Android example")
|
||||
} else {
|
||||
raylib.InitWindow(screenWidth, screenHeight, app)
|
||||
}
|
||||
|
||||
raylib.InitAudioDevice()
|
||||
|
||||
|
@ -44,7 +49,7 @@ func run(app unsafe.Pointer) {
|
|||
for !windowShouldClose {
|
||||
raylib.UpdateMusicStream(ambient)
|
||||
|
||||
if raylib.IsKeyDown(raylib.KeyBack) {
|
||||
if runtime.GOOS == "android" && raylib.IsKeyDown(raylib.KeyBack) || raylib.WindowShouldClose() {
|
||||
windowShouldClose = true
|
||||
}
|
||||
|
||||
|
@ -122,4 +127,5 @@ func run(app unsafe.Pointer) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
run(nil)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue