diff options
Diffstat (limited to 'selection.go')
| -rw-r--r-- | selection.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/selection.go b/selection.go index e41fce3..91f35fe 100644 --- a/selection.go +++ b/selection.go @@ -1,6 +1,8 @@ package main import ( + "age_of_empires/physics" + "github.com/hajimehoshi/ebiten/v2" "golang.org/x/exp/slog" ) @@ -12,10 +14,10 @@ type Selection struct { Halo *ebiten.Image } -func (e *Entity) SelectMultiple(cursor Point, selection GlobalSelection) { +func (e *Entity) SelectMultiple(cursor physics.Point, selection GlobalSelection) { if e.Selection.IsEnabled { e.Selection.Value.IsSelected = false - selectionBounds := Rectangle{selection.Start, cursor}.Canon() + selectionBounds := physics.Rectangle{Min:selection.Start, Max:cursor}.Canon() if selectionBounds.Overlaps(e.Bounds()) { e.Selection.Value.IsSelected = true slog.Info("entity selected", slog.String("position", e.Position.Value.String())) @@ -23,7 +25,7 @@ func (e *Entity) SelectMultiple(cursor Point, selection GlobalSelection) { } } -func (e *Entity) SelectSingle(cursor Point, canBeSelected bool) bool { +func (e *Entity) SelectSingle(cursor physics.Point, canBeSelected bool) bool { if e.Selection.IsEnabled { e.Selection.Value.IsSelected = false if canBeSelected && cursor.In(e.Bounds()) { |
