summaryrefslogtreecommitdiff
path: root/objs/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'objs/root.go')
-rw-r--r--objs/root.go6
1 files changed, 5 insertions, 1 deletions
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
}