41 lines
911 B
Go
41 lines
911 B
Go
package stone
|
|
|
|
type CallbackManager struct {
|
|
onQuit func ()
|
|
onPress func (button Button)
|
|
onRelease func (button Button)
|
|
onResize func ()
|
|
onMouseMove func (x, y int)
|
|
onStart func ()
|
|
}
|
|
|
|
func (manager *CallbackManager) RunQuit () {
|
|
if manager.onQuit == nil { return }
|
|
manager.onQuit()
|
|
}
|
|
|
|
func (manager *CallbackManager) RunPress (button Button) {
|
|
if manager.onPress == nil { return }
|
|
manager.onPress(button)
|
|
}
|
|
|
|
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) RunStart () {
|
|
if manager.onStart == nil { return }
|
|
manager.onStart()
|
|
}
|