Update examples

This commit is contained in:
Milan Nikolic 2022-12-04 13:20:26 +01:00
parent ab3ade6210
commit 317e9eea6a
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
3 changed files with 11 additions and 8 deletions

View file

@ -47,7 +47,7 @@ func main() {
numSamples = samplesLeft numSamples = samplesLeft
} }
rl.UpdateAudioStream(stream, data[totalSamples-samplesLeft:], numSamples) rl.UpdateAudioStream(stream, data[totalSamples-samplesLeft:])
samplesLeft -= numSamples samplesLeft -= numSamples

View file

@ -1,9 +1,11 @@
package main package main
import ( import (
"strings"
"github.com/gen2brain/raylib-go/easings" "github.com/gen2brain/raylib-go/easings"
"github.com/gen2brain/raylib-go/raygui" "github.com/gen2brain/raylib-go/raygui"
"github.com/gen2brain/raylib-go/raylib" rl "github.com/gen2brain/raylib-go/raylib"
) )
func main() { func main() {
@ -21,8 +23,8 @@ func main() {
ballPosition := rl.NewVector2(startPositionX, float32(screenHeight)/2) ballPosition := rl.NewVector2(startPositionX, float32(screenHeight)/2)
comboActive := 0 comboActive := int32(0)
comboLastActive := 0 comboLastActive := int32(0)
easingTypes := []string{"SineIn", "SineOut", "SineInOut", "BounceIn", "BounceOut", "BounceInOut", "BackIn", "BackOut", "BackInOut"} easingTypes := []string{"SineIn", "SineOut", "SineInOut", "BounceIn", "BounceOut", "BounceInOut", "BackIn", "BackOut", "BackInOut"}
ease := easingTypes[comboActive] ease := easingTypes[comboActive]
@ -75,7 +77,7 @@ func main() {
rl.ClearBackground(rl.RayWhite) rl.ClearBackground(rl.RayWhite)
raygui.Label(rl.NewRectangle(20, 20, 200, 20), "Easing Type:") raygui.Label(rl.NewRectangle(20, 20, 200, 20), "Easing Type:")
comboActive = raygui.ComboBox(rl.NewRectangle(20, 40, 200, 20), easingTypes, comboActive) comboActive = raygui.ComboBox(rl.NewRectangle(20, 40, 200, 20), strings.Join(easingTypes, ";"), comboActive)
raygui.Label(rl.NewRectangle(20, 80, 200, 20), "Press R to reset") raygui.Label(rl.NewRectangle(20, 80, 200, 20), "Press R to reset")

View file

@ -1,14 +1,15 @@
package main package main
import ( import (
"github.com/gen2brain/raylib-go/raylib"
"log" "log"
rl "github.com/gen2brain/raylib-go/raylib"
) )
func main() { func main() {
rl.SetTraceLogCallback(func(logType int, str string) { rl.SetTraceLogCallback(func(logType int, str string) {
level := "" level := ""
switch logType { switch rl.TraceLogLevel(logType) {
case rl.LogDebug: case rl.LogDebug:
level = "Debug" level = "Debug"
case rl.LogError: case rl.LogError:
@ -22,7 +23,7 @@ func main() {
case rl.LogFatal: case rl.LogFatal:
level = "Fatal" level = "Fatal"
} }
if logType != rl.LogFatal { if rl.TraceLogLevel(logType) != rl.LogFatal {
log.Printf("%s - %s", level, str) log.Printf("%s - %s", level, str)
} else { } else {
log.Fatalf("%s - %s", level, str) log.Fatalf("%s - %s", level, str)