diff options
| author | ewy <ewy0@protonmail.com> | 2026-08-13 13:59:25 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-08-13 14:03:36 +0200 |
| commit | 06dd690345a02ad5f158138b2d6597220b716e38 (patch) | |
| tree | d2ee623052dbbd215924f95c7d834988d891f89b /objs/cursor.go | |
| parent | 83b6f3af3ff4195801c0973a10c1519958d4fe71 (diff) | |
add stuff
Diffstat (limited to 'objs/cursor.go')
| -rw-r--r-- | objs/cursor.go | 31 |
1 files changed, 31 insertions, 0 deletions
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{}, + } +} |
