tins2020/proxy.go
Sander Schobers 9641719579 Added intro dialog.
Refactored event handling to be able to "handle" events so no other controls will handle the same event again.
2020-05-11 11:44:50 +02:00

38 lines
607 B
Go

package tins2020
import "github.com/veandco/go-sdl2/sdl"
var _ Control = &Proxy{}
type Proxy struct {
Proxied Control
}
func (p *Proxy) Arrange(ctx *Context, bounds Rectangle) {
if p.Proxied == nil {
return
}
p.Proxied.Arrange(ctx, bounds)
}
func (p *Proxy) Handle(ctx *Context, event sdl.Event) bool {
if p.Proxied == nil {
return false
}
return p.Proxied.Handle(ctx, event)
}
func (p *Proxy) Init(ctx *Context) error {
if p.Proxied == nil {
return nil
}
return p.Proxied.Init(ctx)
}
func (p *Proxy) Render(ctx *Context) {
if p.Proxied == nil {
return
}
p.Proxied.Render(ctx)
}