Documentation ¶
Overview ¶
Package input processes button presses from a gamepad or keyboard.
Index ¶
- type Context
- func (c *Context) Consume(btn arcade.Button) bool
- func (c *Context) ConsumeAllowRepeat(btn arcade.Button, delayTicks uint64) bool
- func (c *Context) Held(btn arcade.Button) bool
- func (c *Context) LoadState(s State)
- func (c *Context) Mouse() (x, y float32, click bool)
- func (c *Context) SaveState() State
- func (c *Context) Tick()
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is an input context.
func GetContext ¶
GetContext returns the Context created using NewContext.
It panics if no context was created.
func NewContext ¶
func NewContext(ctx context.Context, fetch func() ([]arcade.Button, float32, float32, bool)) (context.Context, *Context)
NewContext creates a new input context.
func (*Context) Consume ¶
Consume returns true if a button is pressed, and consumes the button press indefinitely.
func (*Context) ConsumeAllowRepeat ¶
ConsumeAllowRepeat returns true if a button is pressed, and consumes the button press for delayTicks.
func (*Context) Mouse ¶ added in v0.2.75
Mouse returns the current mouse position in [0, 1] and whether the button is held.
Click to show internal directories.
Click to hide internal directories.