stone/event.go

47 lines
1.1 KiB
Go

package stone
type CallbackManager struct {
onQuit func ()
onPress func (button Button, modifiers Modifiers)
onRelease func (button Button)
onResize func ()
onMouseMove func (x, y int)
onScroll func (x, y int)
onStart func ()
}
func (manager *CallbackManager) RunQuit () {
if manager.onQuit == nil { return }
manager.onQuit()
}
func (manager *CallbackManager) RunPress (button Button, modifiers Modifiers) {
if manager.onPress == nil { return }
manager.onPress(button, modifiers)
}
func (manager *CallbackManager) RunRelease (button Button) {
if manager.onRelease == nil { return }
manager.onRelease(button)
}
func (manager *CallbackManager) RunResize () {
if manager.onResize == nil { return }
manager.onResize()
}
func (manager *CallbackManager) RunMouseMove (x, y int) {
if manager.onMouseMove == nil { return }
manager.onMouseMove(x, y)
}
func (manager *CallbackManager) RunScroll (x, y int) {
if manager.onScroll == nil { return }
manager.onScroll(x, y)
}
func (manager *CallbackManager) RunStart () {
if manager.onStart == nil { return }
manager.onStart()
}