stone/event.go

47 lines
1.0 KiB
Go
Raw Permalink Normal View History

2022-11-08 23:18:56 -07:00
package stone
2022-11-08 23:12:47 -07:00
2022-11-15 22:29:23 -07:00
type CallbackManager struct {
onQuit func ()
onPress func (button Button)
onRelease func (button Button)
onResize func ()
onMouseMove func (x, y int)
2022-11-17 17:11:49 -07:00
onScroll func (x, y int)
2022-11-15 22:29:23 -07:00
onStart func ()
}
2022-11-08 23:12:47 -07:00
2022-11-15 22:29:23 -07:00
func (manager *CallbackManager) RunQuit () {
if manager.onQuit == nil { return }
manager.onQuit()
}
2022-11-14 22:22:01 -07:00
2022-11-15 22:29:23 -07:00
func (manager *CallbackManager) RunPress (button Button) {
if manager.onPress == nil { return }
manager.onPress(button)
}
2022-11-14 22:22:01 -07:00
2022-11-15 22:29:23 -07:00
func (manager *CallbackManager) RunRelease (button Button) {
if manager.onRelease == nil { return }
manager.onRelease(button)
}
2022-11-14 22:22:01 -07:00
2022-11-15 22:29:23 -07:00
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)
}
2022-11-14 22:22:01 -07:00
2022-11-17 17:11:49 -07:00
func (manager *CallbackManager) RunScroll (x, y int) {
if manager.onScroll == nil { return }
manager.onScroll(x, y)
}
2022-11-15 22:29:23 -07:00
func (manager *CallbackManager) RunStart () {
if manager.onStart == nil { return }
manager.onStart()
2022-11-08 23:12:47 -07:00
}