CodingLand/pkg/internal/land/object.go

31 lines
481 B
Go

package land
import "github.com/veandco/go-sdl2/sdl"
type Object interface {
Create()
Update()
AddChild(child Object)
GetChildren() []Object
}
type DrawableObject interface {
Draw(pen *sdl.Renderer)
}
type BaseObject struct {
Children []Object
}
func (p *BaseObject) Create() {}
func (p *BaseObject) Update() {}
func (p *BaseObject) AddChild(child Object) {
p.Children = append(p.Children, child)
}
func (p *BaseObject) GetChildren() []Object {
return p.Children
}