diff --git a/circle.go b/circle.go new file mode 100644 index 0000000..de242db --- /dev/null +++ b/circle.go @@ -0,0 +1,28 @@ +package gg + +import ( + "github.com/hajimehoshi/ebiten/v2/vector" +) + +type Circle struct { + Object + Transform + Visibility + Colority + Antialiasity + Layer +} + +func (circle *Circle) Draw(c *Context) []EVertex { + rPos := circle.Position.Apply(c.Camera.RealMatrix()) + vector.DrawFilledCircle( + c.Image, + float32(rPos.X), float32(rPos.Y), + float32(circle.Rotation), + circle.Color, + circle.Antialias, + ) + return nil +} + + diff --git a/cmd/test/main.go b/cmd/test/main.go index d2c8777..099ce11 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -52,6 +52,16 @@ func main() { e.Spawn(player) e.Spawn(rect) e.Spawn(tri) + + circle := &gg.Circle{} + circle.Transform = gg.T() + circle.Rotation = 300 + circle.Color = gg.Rgba(1, 1, 1, 1) + circle.Antialias = true + circle.Layer = HighestL + circle.Visible = true + e.Spawn(circle) + fmt.Println(rect.GetLayer(), player.GetLayer()) err = e.Run() diff --git a/object.go b/object.go index d3c428b..1c54efc 100644 --- a/object.go +++ b/object.go @@ -23,6 +23,10 @@ type Deleter interface { Delete(*Context) } +type Antialiasity struct { + Antialias bool +} + // Feat to embed for turning visibility on and off. type Visibility struct { Visible bool