aboutsummaryrefslogtreecommitdiff
path: root/selection.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-25 11:41:19 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-25 11:41:19 +0200
commit563b9ee704a14322ed4805896c4f8ca3fa5df03a (patch)
tree302580bbc98354d5286ffd19c12fd40729e4696f /selection.go
parent500df7635bf1b24f19bec5dede929389bb1b179c (diff)
feat: Selection with priority
Diffstat (limited to 'selection.go')
-rw-r--r--selection.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/selection.go b/selection.go
deleted file mode 100644
index 496d7f6..0000000
--- a/selection.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package main
-
-import (
- "age_of_empires/physics"
-
- "github.com/hajimehoshi/ebiten/v2"
- "golang.org/x/exp/slog"
-)
-
-const SELECTION_HALO_WIDTH = 10
-
-type Selection struct {
- IsSelected bool
- Halo *ebiten.Image
-}
-
-func (e *Entity) SelectMultiple(cursor physics.Point, selection GlobalSelection) {
- if !e.Selection.IsEnabled {
- return
- }
- e.Selection.Value.IsSelected = false
- 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()))
- }
-}
-
-func (e *Entity) SelectSingle(cursor physics.Point, canBeSelected bool) bool {
- if !e.Selection.IsEnabled {
- return false
- }
- e.Selection.Value.IsSelected = false
- if !canBeSelected || !cursor.In(e.Bounds()) {
- return false
- }
- e.Selection.Value.IsSelected = true
- slog.Info("entity selected", slog.String("position", e.Position.Value.String()))
- return true
-}