From 06dd690345a02ad5f158138b2d6597220b716e38 Mon Sep 17 00:00:00 2001 From: ewy Date: Thu, 13 Aug 2026 13:59:25 +0200 Subject: add stuff --- objs/cursor.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 objs/cursor.go (limited to 'objs/cursor.go') diff --git a/objs/cursor.go b/objs/cursor.go new file mode 100644 index 0000000..b1fdca3 --- /dev/null +++ b/objs/cursor.go @@ -0,0 +1,31 @@ +package objs + +import ( + "github.com/Zyko0/go-sdl3/sdl" + "ponger/ecs" + "ponger/input" +) + +type Cursor struct { + *ecs.GameObject +} + +func (c *Cursor) Render(renderer *sdl.Renderer) { + renderer.SetDrawColor(255, 0, 0, 255) + renderer.RenderPoint(c.Position.X, c.Position.Y) +} + +func (c *Cursor) Process(ev input.Event) { + c.Position.X += ev.Dx + c.Position.Y += ev.Dy +} + +func (c *Cursor) GO() *ecs.GameObject { + return c.GameObject +} + +func NewCursor() ecs.IsGameObject { + return &Cursor{ + GameObject: &ecs.GameObject{}, + } +} -- cgit v1.3.1