diff --git a/examples/splashmenu/scenes/noise.go b/examples/splashmenu/scenes/noise.go index 2ec1177..262de38 100644 --- a/examples/splashmenu/scenes/noise.go +++ b/examples/splashmenu/scenes/noise.go @@ -6,6 +6,7 @@ import ( "fmt" "image" "image/color" + "math" "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/inpututil" @@ -105,10 +106,10 @@ func (n *Noisy) SetDimensions(a groovy.Area) { func (n *Noisy) UpdateNoise() { //update cursor position and lock it into the game region bounds n.sX, n.sY = ebiten.CursorPosition() - n.sX = min(n.sX, n.Dimensions.Width-1) - n.sX = max(n.sX, 0) - n.sY = min(n.sY, n.Dimensions.Height-1) - n.sY = max(n.sY, 0) + n.sX = int(math.Min(float64(n.sX), float64(n.Dimensions.Width-1))) + n.sX = int(math.Max(float64(n.sX), 0)) + n.sY = int(math.Min(float64(n.sY), float64(n.Dimensions.Height-1))) + n.sY = int(math.Max(float64(n.sY), 0)) l := n.Dimensions.Width * n.Dimensions.Height