summaryrefslogtreecommitdiff
path: root/objs
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-08-13 15:13:39 +0200
committerewy <ewy0@protonmail.com>2026-08-13 15:13:39 +0200
commit60f58e548ef745ec072482954ac37c35d88280d4 (patch)
treeb1d89c0c1e47a427334e7fe708367b1263aaef40 /objs
parentd0fe29558b040a11c5c8a744c37fbd2e3826f6c4 (diff)
switch to single render loop
Diffstat (limited to 'objs')
-rw-r--r--objs/cursor.go4
-rw-r--r--objs/paddle.go6
-rw-r--r--objs/root.go6
3 files changed, 7 insertions, 9 deletions
diff --git a/objs/cursor.go b/objs/cursor.go
index f6d412b..817279b 100644
--- a/objs/cursor.go
+++ b/objs/cursor.go
@@ -3,7 +3,7 @@ package objs
import (
"github.com/Zyko0/go-sdl3/sdl"
"ponger/ecs"
- "ponger/input"
+ "ponger/events"
)
type Cursor struct {
@@ -22,7 +22,7 @@ func (c *Cursor) Render(renderer *sdl.Renderer) {
renderer.RenderRect(r)
}
-func (c *Cursor) Process(ev input.Event) {
+func (c *Cursor) ProcessMouseMotion(ev events.MouseMotion) {
c.Position.X += ev.Dx
c.Position.Y += ev.Dy
if c.Position.X < 0 {
diff --git a/objs/paddle.go b/objs/paddle.go
index 843c301..fa7cea0 100644
--- a/objs/paddle.go
+++ b/objs/paddle.go
@@ -3,18 +3,12 @@ package objs
import (
"github.com/Zyko0/go-sdl3/sdl"
"ponger/ecs"
- "ponger/input"
)
type Paddle struct {
*ecs.GameObject
}
-func (p *Paddle) Process(ev input.Event) {
- //TODO implement me
- panic("implement me")
-}
-
func NewPaddle() ecs.IsGameObject {
p := &Paddle{
GameObject: &ecs.GameObject{
diff --git a/objs/root.go b/objs/root.go
index 649200d..44309ac 100644
--- a/objs/root.go
+++ b/objs/root.go
@@ -7,6 +7,7 @@ import (
type Root struct {
*ecs.GameObject
+ Height, Width int32
}
func (root *Root) Render(r *sdl.Renderer) {
@@ -14,12 +15,15 @@ func (root *Root) Render(r *sdl.Renderer) {
r.Clear()
}
-func NewRoot(children ...ecs.IsGameObject) ecs.IsGameObject {
+func NewRoot(window *sdl.Window, children ...ecs.IsGameObject) ecs.IsGameObject {
+ x, y, _ := window.Size()
r := &Root{
GameObject: &ecs.GameObject{
Position: sdl.FPoint{},
Children: children,
},
+ Width: x,
+ Height: y,
}
return r
}