summaryrefslogtreecommitdiff
path: root/objs/cursor.go
diff options
context:
space:
mode:
Diffstat (limited to 'objs/cursor.go')
-rw-r--r--objs/cursor.go31
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{},
+ }
+}