Using the math versions of min/max now.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user