summaryrefslogtreecommitdiff
path: root/objs
diff options
context:
space:
mode:
authorusr <usr@devuan>2026-08-13 14:49:29 +0200
committerusr <usr@devuan>2026-08-13 14:49:29 +0200
commit874eebf5d22670993428a189acd479cd9c998e35 (patch)
treed943032feb6b79c57c3db607abb14636a2d4a184 /objs
parent387867e161ed0be29baf2bfa2c496dd21f3662e8 (diff)
parenta5ce1401312b97fd447d00656b250571c4db4880 (diff)
Merge branch 'master' of ewy.one:ponger
Diffstat (limited to 'objs')
-rw-r--r--objs/cursor.go14
-rw-r--r--objs/root.go4
2 files changed, 15 insertions, 3 deletions
diff --git a/objs/cursor.go b/objs/cursor.go
index b1fdca3..dd09a8b 100644
--- a/objs/cursor.go
+++ b/objs/cursor.go
@@ -12,12 +12,24 @@ type Cursor struct {
func (c *Cursor) Render(renderer *sdl.Renderer) {
renderer.SetDrawColor(255, 0, 0, 255)
- renderer.RenderPoint(c.Position.X, c.Position.Y)
+ r := &sdl.FRect{
+ X: c.Position.X - 5,
+ Y: c.Position.Y - 5,
+ W: 10,
+ H: 10,
+ }
+ renderer.RenderRect(r)
}
func (c *Cursor) Process(ev input.Event) {
c.Position.X += ev.Dx
c.Position.Y += ev.Dy
+ if c.Position.X < 0 {
+ c.Position.X = 0
+ }
+ if c.Position.Y < 0 {
+ c.Position.Y = 0
+ }
}
func (c *Cursor) GO() *ecs.GameObject {
diff --git a/objs/root.go b/objs/root.go
index 59e0c6a..649200d 100644
--- a/objs/root.go
+++ b/objs/root.go
@@ -10,7 +10,7 @@ type Root struct {
}
func (root *Root) Render(r *sdl.Renderer) {
- r.SetDrawColor(255, 255, 255, 255)
+ r.SetDrawColor(0, 0, 0, 255)
r.Clear()
}
@@ -21,5 +21,5 @@ func NewRoot(children ...ecs.IsGameObject) ecs.IsGameObject {
Children: children,
},
}
- return r.GameObject
+ return r
}