Documentation ¶
Overview ¶
Package ebiten provides graphics and input API to develop a 2D game.
Index ¶
- type InputService
- func (is InputService) CursorPosition() (x, y int)
- func (is InputService) InputChars() []rune
- func (is InputService) IsKeyJustPressed(key d2enum.Key) bool
- func (is InputService) IsKeyJustReleased(key d2enum.Key) bool
- func (is InputService) IsKeyPressed(key d2enum.Key) bool
- func (is InputService) IsMouseButtonJustPressed(button d2enum.MouseButton) bool
- func (is InputService) IsMouseButtonJustReleased(button d2enum.MouseButton) bool
- func (is InputService) IsMouseButtonPressed(button d2enum.MouseButton) bool
- func (is InputService) KeyPressDuration(key d2enum.Key) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InputService ¶
type InputService struct{}
InputService provides an abstraction on ebiten to support handling input events
func (InputService) CursorPosition ¶
func (is InputService) CursorPosition() (x, y int)
CursorPosition returns a position of a mouse cursor relative to the game screen (window).
func (InputService) InputChars ¶
func (is InputService) InputChars() []rune
InputChars return "printable" runes read from the keyboard at the time update is called.
func (InputService) IsKeyJustPressed ¶
func (is InputService) IsKeyJustPressed(key d2enum.Key) bool
IsKeyJustPressed checks if the provided key is just transitioned from up to down.
func (InputService) IsKeyJustReleased ¶
func (is InputService) IsKeyJustReleased(key d2enum.Key) bool
IsKeyJustReleased checks if the provided key is just transitioned from down to up.
func (InputService) IsKeyPressed ¶
func (is InputService) IsKeyPressed(key d2enum.Key) bool
IsKeyPressed checks if the provided key is down.
func (InputService) IsMouseButtonJustPressed ¶
func (is InputService) IsMouseButtonJustPressed(button d2enum.MouseButton) bool
IsMouseButtonJustPressed checks if the provided mouse button is just transitioned from up to down.
func (InputService) IsMouseButtonJustReleased ¶
func (is InputService) IsMouseButtonJustReleased(button d2enum.MouseButton) bool
IsMouseButtonJustReleased checks if the provided mouse button is just transitioned from down to up.
func (InputService) IsMouseButtonPressed ¶
func (is InputService) IsMouseButtonPressed(button d2enum.MouseButton) bool
IsMouseButtonPressed checks if the provided mouse button is down.
func (InputService) KeyPressDuration ¶
func (is InputService) KeyPressDuration(key d2enum.Key) int
KeyPressDuration returns how long the key is pressed in frames.