1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-12-27 04:26:29 -05:00

add comment explaining significance of input handler return value (#895)

This commit is contained in:
gravestench 2020-11-02 09:14:03 +00:00 committed by GitHub
parent 004a3faf7d
commit b052006922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,42 +3,47 @@ package d2interface
// InputEventHandler is an event handler // InputEventHandler is an event handler
type InputEventHandler interface{} type InputEventHandler interface{}
/*
NOTE: The return values of the handler methods below are used to prevent
other bound handlers from being called (if the handler returns `true`).
*/
// KeyDownHandler represents a handler for a keyboard key pressed event // KeyDownHandler represents a handler for a keyboard key pressed event
type KeyDownHandler interface { type KeyDownHandler interface {
OnKeyDown(event KeyEvent) bool OnKeyDown(event KeyEvent) (preventPropagation bool)
} }
// KeyRepeatHandler represents a handler for a keyboard key held-down event; between a pressed and released. // KeyRepeatHandler represents a handler for a keyboard key held-down event; between a pressed and released.
type KeyRepeatHandler interface { type KeyRepeatHandler interface {
OnKeyRepeat(event KeyEvent) bool OnKeyRepeat(event KeyEvent) (preventPropagation bool)
} }
// KeyUpHandler represents a handler for a keyboard key release event // KeyUpHandler represents a handler for a keyboard key release event
type KeyUpHandler interface { type KeyUpHandler interface {
OnKeyUp(event KeyEvent) bool OnKeyUp(event KeyEvent) (preventPropagation bool)
} }
// KeyCharsHandler represents a handler associated with a keyboard character pressed event // KeyCharsHandler represents a handler associated with a keyboard character pressed event
type KeyCharsHandler interface { type KeyCharsHandler interface {
OnKeyChars(event KeyCharsEvent) bool OnKeyChars(event KeyCharsEvent) (preventPropagation bool)
} }
// MouseButtonDownHandler represents a handler for a mouse button pressed event // MouseButtonDownHandler represents a handler for a mouse button pressed event
type MouseButtonDownHandler interface { type MouseButtonDownHandler interface {
OnMouseButtonDown(event MouseEvent) bool OnMouseButtonDown(event MouseEvent) (preventPropagation bool)
} }
// MouseButtonRepeatHandler represents a handler for a mouse button held-down event; between a pressed and released. // MouseButtonRepeatHandler represents a handler for a mouse button held-down event; between a pressed and released.
type MouseButtonRepeatHandler interface { type MouseButtonRepeatHandler interface {
OnMouseButtonRepeat(event MouseEvent) bool OnMouseButtonRepeat(event MouseEvent) (preventPropagation bool)
} }
// MouseButtonUpHandler represents a handler for a mouse button release event // MouseButtonUpHandler represents a handler for a mouse button release event
type MouseButtonUpHandler interface { type MouseButtonUpHandler interface {
OnMouseButtonUp(event MouseEvent) bool OnMouseButtonUp(event MouseEvent) (preventPropagation bool)
} }
// MouseMoveHandler represents a handler for a mouse button release event // MouseMoveHandler represents a handler for a mouse button release event
type MouseMoveHandler interface { type MouseMoveHandler interface {
OnMouseMove(event MouseMoveEvent) bool OnMouseMove(event MouseMoveEvent) (preventPropagation bool)
} }