Documentation ¶
Index ¶
- type Action
- type AxisHandler
- type AxisHandlerMap
- type ButtonHandler
- type ButtonHandlerMap
- type GamepadAxisMap
- func (gm *GamepadAxisMap) Actions() []Action
- func (gm *GamepadAxisMap) Axes() []int
- func (gm *GamepadAxisMap) DelAction(a Action)
- func (gm *GamepadAxisMap) DelAxis(ax int)
- func (gm *GamepadAxisMap) GetAction(b int) (a Action, ok bool)
- func (gm *GamepadAxisMap) GetAxis(a Action) (ax int, ok bool)
- func (gm *GamepadAxisMap) Set(ax int, a Action)
- type GamepadBtnMap
- func (gm *GamepadBtnMap) Actions() []Action
- func (gm *GamepadBtnMap) Buttons() []ebiten.GamepadButton
- func (gm *GamepadBtnMap) DelAction(a Action)
- func (gm *GamepadBtnMap) DelButton(b ebiten.GamepadButton)
- func (gm *GamepadBtnMap) GetAction(b ebiten.GamepadButton) (a Action, ok bool)
- func (gm *GamepadBtnMap) GetButton(a Action) (b ebiten.GamepadButton, ok bool)
- func (gm *GamepadBtnMap) Set(b ebiten.GamepadButton, a Action)
- type KeyMap
- type KeyMouseMap
- func (km *KeyMouseMap) Actions() []Action
- func (km *KeyMouseMap) Buttons() []button.KeyMouse
- func (km *KeyMouseMap) DelAction(a Action)
- func (km *KeyMouseMap) DelButton(b button.KeyMouse)
- func (km *KeyMouseMap) GetAction(b button.KeyMouse) (a Action, ok bool)
- func (km *KeyMouseMap) GetButton(a Action) (b button.KeyMouse, ok bool)
- func (km *KeyMouseMap) Set(b button.KeyMouse, a Action)
- type Layers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AxisHandler ¶
AxisHandler is a function that handles gamepad axis state. The function will directly be given the result of ebiten.GamepadAxis. It should return true if no later handlers should be called for the same axis.
type AxisHandlerMap ¶
type AxisHandlerMap map[Action]AxisHandler
AxisHandlerMap maps axis Actions to their handlers.
type ButtonHandler ¶
ButtonHandler is a function that handles a button state. The parameter down is true if the button is pressed. It should return true if no later handlers should be called for the same button.
type ButtonHandlerMap ¶
type ButtonHandlerMap map[Action]ButtonHandler
ButtonHandlerMap maps button Actions to their handlers.
type GamepadAxisMap ¶
type GamepadAxisMap struct {
// contains filtered or unexported fields
}
GamepadAxisMap is a bi-directional map connecting gamepad axes and actions.
func NewGamepadAxisMap ¶
func NewGamepadAxisMap() *GamepadAxisMap
NewGamepadAxisMap returns a new, initialized GamepadAxisMap.
func (*GamepadAxisMap) Actions ¶
func (gm *GamepadAxisMap) Actions() []Action
Actions returns a slice containing all actions currently in the map.
func (*GamepadAxisMap) Axes ¶
func (gm *GamepadAxisMap) Axes() []int
Axes returns a slice containing all axes currently in the map.
func (*GamepadAxisMap) DelAction ¶
func (gm *GamepadAxisMap) DelAction(a Action)
DelAction removes the action and its associated axis.
func (*GamepadAxisMap) DelAxis ¶
func (gm *GamepadAxisMap) DelAxis(ax int)
DelAxis removes the axis and its associated action.
func (*GamepadAxisMap) GetAction ¶
func (gm *GamepadAxisMap) GetAction(b int) (a Action, ok bool)
GetAction returns the action associated with the button.
func (*GamepadAxisMap) GetAxis ¶
func (gm *GamepadAxisMap) GetAxis(a Action) (ax int, ok bool)
GetAxis returns the axis associated with the action.
func (*GamepadAxisMap) Set ¶
func (gm *GamepadAxisMap) Set(ax int, a Action)
Set associates the given axis and action with each other.
type GamepadBtnMap ¶
type GamepadBtnMap struct {
// contains filtered or unexported fields
}
GamepadBtnMap is a bi-directional map connecting gamepad buttons and actions.
func NewGamepadBtnMap ¶
func NewGamepadBtnMap() *GamepadBtnMap
NewGamepadBtnMap returns a new, initialized GamepadBtnMap.
func (*GamepadBtnMap) Actions ¶
func (gm *GamepadBtnMap) Actions() []Action
Actions returns a slice containing all actions currently in the map.
func (*GamepadBtnMap) Buttons ¶
func (gm *GamepadBtnMap) Buttons() []ebiten.GamepadButton
Buttons returns a slice containing all buttons currently in the map.
func (*GamepadBtnMap) DelAction ¶
func (gm *GamepadBtnMap) DelAction(a Action)
DelAction removes the action and its associated button.
func (*GamepadBtnMap) DelButton ¶
func (gm *GamepadBtnMap) DelButton(b ebiten.GamepadButton)
DelButton removes the button and its associated action.
func (*GamepadBtnMap) GetAction ¶
func (gm *GamepadBtnMap) GetAction(b ebiten.GamepadButton) (a Action, ok bool)
GetAction returns the action associated with the button.
func (*GamepadBtnMap) GetButton ¶
func (gm *GamepadBtnMap) GetButton(a Action) (b ebiten.GamepadButton, ok bool)
GetButton returns the button associated with the action.
func (*GamepadBtnMap) Set ¶
func (gm *GamepadBtnMap) Set(b ebiten.GamepadButton, a Action)
Set associates the given button and action with each other.
type KeyMap ¶
type KeyMap struct { KeyMouse *KeyMouseMap GamepadBtn *GamepadBtnMap GamepadAxis *GamepadAxisMap // contains filtered or unexported fields }
KeyMap groups all map types.
func New ¶
func New(btnHandlers ButtonHandlerMap, gamepadAxisHandlers AxisHandlerMap) *KeyMap
New creates and returns a new, empty KeyMap. The btnHandlers map shared between keyboard/mouse and gamepad buttons. This means that if an action handler for a keyboard/mouse buttton stops propagation then a gamepad button that maps to the same action in a later layer will not be handled.
type KeyMouseMap ¶
type KeyMouseMap struct {
// contains filtered or unexported fields
}
KeyMouseMap is a bi-directional map connecting keyboard/mouse buttons and actions.
func NewKeyMouseMap ¶
func NewKeyMouseMap() *KeyMouseMap
NewKeyMouseMap returns a new, initialized KeyMouseMap.
func (*KeyMouseMap) Actions ¶
func (km *KeyMouseMap) Actions() []Action
Actions returns a slice containing all actions currently in the map.
func (*KeyMouseMap) Buttons ¶
func (km *KeyMouseMap) Buttons() []button.KeyMouse
Buttons returns a slice containing all buttons currently in the map.
func (*KeyMouseMap) DelAction ¶
func (km *KeyMouseMap) DelAction(a Action)
DelAction removes the action and its associated button.
func (*KeyMouseMap) DelButton ¶
func (km *KeyMouseMap) DelButton(b button.KeyMouse)
DelButton removes the button and its associated action.
func (*KeyMouseMap) GetAction ¶
func (km *KeyMouseMap) GetAction(b button.KeyMouse) (a Action, ok bool)
GetAction returns the action associated with the button.