1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-02 17:27:23 -04:00
OpenDiablo2/d2common/d2interface/input_events.go
dk 62b8a610c0
D2input abstraction (#532)
* abstract d2input manager/service/events/keys/buttons to interface

* abstract d2input manager/service/events/keys/buttons to interface

* fixing lint error
2020-07-03 15:09:16 -04:00

35 lines
745 B
Go

package d2interface
// HandlerEvent holds the qualifiers for a key or mouse event
type HandlerEvent interface {
KeyMod() KeyMod
ButtonMod() MouseButtonMod
X() int
Y() int
}
// KeyEvent represents an event associated with a keyboard key
type KeyEvent interface {
HandlerEvent
Key() Key
// 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
Button() MouseButton
}
// MouseMoveEvent represents a mouse movement event
type MouseMoveEvent interface {
HandlerEvent
}