29 lines
563 B
Go
29 lines
563 B
Go
|
package tins2020
|
||
|
|
||
|
import "github.com/veandco/go-sdl2/sdl"
|
||
|
|
||
|
// Content shortcuts events when a dialog is opened.
|
||
|
type Content struct {
|
||
|
Container
|
||
|
|
||
|
dialogOverlayed bool
|
||
|
}
|
||
|
|
||
|
func NewContent(dialogs *Dialogs) *Content {
|
||
|
content := &Content{}
|
||
|
dialogs.DialogOpened().Register(func() {
|
||
|
content.dialogOverlayed = true
|
||
|
})
|
||
|
dialogs.DialogClosed().Register(func() {
|
||
|
content.dialogOverlayed = false
|
||
|
})
|
||
|
return content
|
||
|
}
|
||
|
|
||
|
func (c *Content) Handle(ctx *Context, event sdl.Event) bool {
|
||
|
if c.dialogOverlayed {
|
||
|
return false
|
||
|
}
|
||
|
return c.Container.Handle(ctx, event)
|
||
|
}
|