1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-12 23:43:24 -05:00
OpenDiablo2/d2core/d2input/input_service.go
Maxime Lavigne (malavv) 973e969002
Working on d2input.go for #487 (#514)
d2input/ is now clear of lint.
2020-07-01 14:03:40 -04:00

24 lines
1.2 KiB
Go

package d2input
// InputService represents an interface offering Keyboard and Mouse interactions.
type InputService interface {
// CursorPosition returns a position of a mouse cursor relative to the game screen (window).
CursorPosition() (x int, y int)
// InputChars return "printable" runes read from the keyboard at the time update is called.
InputChars() []rune
// IsKeyPressed checks if the provided key is down.
IsKeyPressed(key Key) bool
// IsKeyJustPressed checks if the provided key is just transitioned from up to down.
IsKeyJustPressed(key Key) bool
// IsKeyJustReleased checks if the provided key is just transitioned from down to up.
IsKeyJustReleased(key Key) bool
// IsMouseButtonPressed checks if the provided mouse button is down.
IsMouseButtonPressed(button MouseButton) bool
// IsMouseButtonJustPressed checks if the provided mouse button is just transitioned from up to down.
IsMouseButtonJustPressed(button MouseButton) bool
// IsMouseButtonJustReleased checks if the provided mouse button is just transitioned from down to up.
IsMouseButtonJustReleased(button MouseButton) bool
// KeyPressDuration returns how long the key is pressed in frames.
KeyPressDuration(key Key) int
}