aboutsummaryrefslogtreecommitdiff
path: root/image.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 07:04:35 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 07:04:35 +0200
commitbf546b1b4c92d3d358a85b6b760dad01bc95ea7c (patch)
tree898680c3e7b5c32ff206cbd075023b15f3356f4e /image.go
parent7b805f2bcc3b25c9077ec39fc0693091a4e05b0a (diff)
feat(selection): Use circle for units
Diffstat (limited to 'image.go')
-rw-r--r--image.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/image.go b/image.go
index 0823576..5045d90 100644
--- a/image.go
+++ b/image.go
@@ -4,10 +4,29 @@ import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
+ "github.com/hajimehoshi/ebiten/v2/vector"
)
-func NewColorImage(size Point, color color.Color) *ebiten.Image {
+func NewFilledRectangleImage(size Point, color color.Color) *ebiten.Image {
image := ebiten.NewImage(size.X, size.Y)
image.Fill(color)
return image
}
+
+func NewStrokeRectangleImage(size Point, strokeWidth int, color color.Color) *ebiten.Image {
+ image := ebiten.NewImage(size.X, size.Y)
+ vector.StrokeRect(image, 0, 0, float32(size.X), float32(size.Y), float32(strokeWidth), color, true)
+ return image
+}
+
+func NewFilledCircleImage(width int, color color.Color) *ebiten.Image {
+ image := ebiten.NewImage((width), (width))
+ vector.DrawFilledCircle(image, float32(width/2), float32(width/2), float32(width/2), color, true)
+ return image
+}
+
+func NewStrokeCircleImage(width int, strokeWidth int, color color.Color) *ebiten.Image {
+ image := ebiten.NewImage((width), (width))
+ vector.StrokeCircle(image, float32(width/2), float32(width/2), float32(width/2), float32(strokeWidth), color, true)
+ return image
+}