blob: 92f380405f6b6d9efa6ac9f915a8cb72336fef98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package objs
import (
"github.com/Zyko0/go-sdl3/sdl"
"ponger/ecs"
)
type Root struct {
*ecs.GameObject
Height, Width int32
}
func (root *Root) Render(r *sdl.Renderer) {
root.Safe(r.SetDrawColor(0, 0, 0, 255))
root.Safe(r.Clear())
}
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
}
|