2020-07-03 15:09:16 -04:00
|
|
|
package d2interface
|
|
|
|
|
2020-07-06 21:26:08 -04:00
|
|
|
import "github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
|
|
|
|
|
2020-07-03 15:09:16 -04:00
|
|
|
// HandlerEvent holds the qualifiers for a key or mouse event
|
|
|
|
type HandlerEvent interface {
|
2020-07-06 21:26:08 -04:00
|
|
|
KeyMod() d2enum.KeyMod
|
|
|
|
ButtonMod() d2enum.MouseButtonMod
|
2020-07-03 15:09:16 -04:00
|
|
|
X() int
|
|
|
|
Y() int
|
|
|
|
}
|
|
|
|
|
|
|
|
// KeyEvent represents an event associated with a keyboard key
|
|
|
|
type KeyEvent interface {
|
|
|
|
HandlerEvent
|
2020-07-06 21:26:08 -04:00
|
|
|
Key() d2enum.Key
|
2020-07-03 15:09:16 -04:00
|
|
|
// Duration represents the number of frames this key has been pressed for
|
|
|
|
Duration() int
|
|
|
|
}
|
|
|
|
|
|
|
|
// KeyCharsEvent represents an event associated with a keyboard character being pressed
|
|
|
|
type KeyCharsEvent interface {
|
|
|
|
HandlerEvent
|
|
|
|
Chars() []rune
|
|
|
|
}
|
|
|
|
|
|
|
|
// MouseEvent represents a mouse event
|
|
|
|
type MouseEvent interface {
|
|
|
|
HandlerEvent
|
2020-07-06 21:26:08 -04:00
|
|
|
Button() d2enum.MouseButton
|
2020-07-03 15:09:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// MouseMoveEvent represents a mouse movement event
|
|
|
|
type MouseMoveEvent interface {
|
|
|
|
HandlerEvent
|
|
|
|
}
|