From bd750fa2605eecd14ab821f630a7c1b51c48c982 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Thu, 25 Sep 2025 22:15:45 +0200 Subject: Improve selection code --- draw.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'draw.go') 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) -- cgit v1.3