From 05dde984e9a59bf7d741df59974228695d3219cc Mon Sep 17 00:00:00 2001 From: dbenavid Date: Tue, 5 Sep 2023 07:52:41 -0400 Subject: [PATCH] Using the math versions of min/max now. --- examples/splashmenu/scenes/noise.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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