aboutsummaryrefslogtreecommitdiff
path: root/draw.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-09-25 22:15:45 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-09-25 22:15:45 +0200
commitbd750fa2605eecd14ab821f630a7c1b51c48c982 (patch)
treed6974c0d5bf1ffad274dce070a5ce979d887425d /draw.go
parent4f2217d74d1fa39235ffd9e3d378099d20c5cc56 (diff)
Improve selection code
Diffstat (limited to 'draw.go')
-rw-r--r--draw.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/draw.go b/draw.go
index b89ffa1..970974f 100644
--- a/draw.go
+++ b/draw.go
@@ -1,11 +1,12 @@
package main
import (
- "age_of_empires/physics"
- "age_of_empires/selection"
"fmt"
"image/color"
+ "age_of_empires/physics"
+ "age_of_empires/selection"
+
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/text/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
@@ -94,8 +95,8 @@ func (g *Game) Draw(screen *ebiten.Image) {
for _, e := range g.Entities {
e.Draw(g, screen)
}
- if g.Selection.IsActive {
- vector.StrokeRect(screen, float32(g.Selection.Start.X), float32(g.Selection.Start.Y), float32(cursor.X-g.Selection.Start.X), float32(cursor.Y-g.Selection.Start.Y), 10.0, color.RGBA{256 * 3 / 16, 256 * 3 / 16, 256 * 3 / 16, 256 / 4}, true)
+ if g.Selection.IsActive(cursor) {
+ g.Selection.Draw(screen, cursor)
}
drawTopBanner(screen, g)