Update examples

This commit is contained in:
Milan Nikolic 2022-08-27 18:42:04 +02:00
parent 6e090424c5
commit 8e21086fe1
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
4 changed files with 11 additions and 12 deletions

View file

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/gen2brain/raylib-go/raylib" rl "github.com/gen2brain/raylib-go/raylib"
) )
func main() { func main() {
@ -18,7 +18,7 @@ func main() {
rl.SetTargetFPS(60) rl.SetTargetFPS(60)
for !rl.WindowShouldClose() { for !rl.WindowShouldClose() {
boxPositionY -= rl.GetMouseWheelMove() * scrollSpeed boxPositionY -= int32(rl.GetMouseWheelMove()) * scrollSpeed
rl.BeginDrawing() rl.BeginDrawing()

View file

@ -3,10 +3,10 @@ module examples
go 1.16 go 1.16
require ( require (
github.com/gen2brain/raylib-go/easings v0.0.0-20220323230550-c878e5c98a96 github.com/gen2brain/raylib-go/easings v0.0.0-20220827153754-6e090424c541
github.com/gen2brain/raylib-go/physics v0.0.0-20220323230550-c878e5c98a96 github.com/gen2brain/raylib-go/physics v0.0.0-20220827153754-6e090424c541
github.com/gen2brain/raylib-go/raygui v0.0.0-20220323230550-c878e5c98a96 github.com/gen2brain/raylib-go/raygui v0.0.0-20220827153754-6e090424c541
github.com/gen2brain/raylib-go/raylib v0.0.0-20220323230550-c878e5c98a96 github.com/gen2brain/raylib-go/raylib v0.0.0-20220827153754-6e090424c541
github.com/jakecoffman/cp v1.1.0 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
) )

View file

@ -5,7 +5,7 @@ import (
"math" "math"
"math/rand" "math/rand"
"github.com/gen2brain/raylib-go/raylib" rl "github.com/gen2brain/raylib-go/raylib"
"github.com/jakecoffman/cp" "github.com/jakecoffman/cp"
) )
@ -85,7 +85,7 @@ func main() {
for !rl.WindowShouldClose() { for !rl.WindowShouldClose() {
// calculate dt // calculate dt
now := rl.GetTime() now := rl.GetTime()
dt = now - lastTime dt = float32(now - lastTime)
lastTime = now lastTime = now
// update the mouse position // update the mouse position

View file

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/gen2brain/raylib-go/raylib" rl "github.com/gen2brain/raylib-go/raylib"
) )
func main() { func main() {
@ -11,8 +11,7 @@ func main() {
rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - image text drawing") rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - image text drawing")
// TTF Font loading with custom generation parameters // TTF Font loading with custom generation parameters
var fontChars int32 font := rl.LoadFontEx("fonts/KAISG.ttf", 64, nil)
font := rl.LoadFontEx("fonts/KAISG.ttf", 64, &fontChars, 0)
parrots := rl.LoadImage("parrots.png") // Load image in CPU memory (RAM) parrots := rl.LoadImage("parrots.png") // Load image in CPU memory (RAM)