Documentation
¶
Overview ¶
Package userinput handles input from real hardware that the the user of the emulator is using to control the emualted console.
It can be thought of as a translation layer between the GUI implementation and the hardware riot.ports package. As such, this package attempts to hide details of the GUI implementation while protecting the ports package from complication.
The GUI implementation in use during development was SDL and so there will be a bias towards that system.
Index ¶
- type Controllers
- type DPadDirection
- type Event
- type EventGamepadButton
- type EventGamepadDPad
- type EventGamepadThumbstick
- type EventGamepadTrigger
- type EventKeyboard
- type EventMouseButton
- type EventMouseMotion
- type EventMouseWheel
- type EventQuit
- type GamepadButton
- type GamepadThumbstick
- type GamepadTrigger
- type HandleInput
- type KeyMod
- type MouseButton
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controllers ¶
type Controllers struct {
// contains filtered or unexported fields
}
Controllers keeps track of hardware userinput options.
func (*Controllers) HandleUserInput ¶
func (c *Controllers) HandleUserInput(ev Event, handle HandleInput) (bool, error)
HandleUserInput deciphers the Event and forwards the input to the Atari 2600 player ports. Returns True if event should cause emulation to quit; in addition to any error.
type DPadDirection ¶
type DPadDirection int
DPadDirection indentifies the direction the dpad is being pressed.
const ( DPadNone DPadDirection = iota DPadCentre DPadUp DPadDown DPadLeft DPadRight DPadLeftUp DPadLeftDown DPadRightUp DPadRightDown )
List of valid DPadDirection values.
type Event ¶
type Event interface{}
Event represents all the different type of events that can occur in the GUI.
Events are the things that happen in the GUI, as a result of user interaction, and sent over a registered event channel.
type EventGamepadButton ¶
type EventGamepadButton struct { ID plugging.PortID Button GamepadButton Down bool }
EventGamepadButton data is generated by any of a game controller's buttons.
type EventGamepadDPad ¶
type EventGamepadDPad struct { ID plugging.PortID Direction DPadDirection }
EventGamepadDpad data is generated by a game controller's DPad.
type EventGamepadThumbstick ¶
type EventGamepadThumbstick struct { ID plugging.PortID // the axis being moved Thumbstick GamepadThumbstick // value from hardware controller should use full range Horiz int16 Vert int16 }
EventGamepadThumbstick data is generated by a gamepad's analogue sticks.
type EventGamepadTrigger ¶
type EventGamepadTrigger struct { ID plugging.PortID // the trigger being flexed Trigger GamepadTrigger // value from hardware controller should use full range Amount int16 }
EventGamepadAnalogue data is generated by a gamepads analogue triggers.
type EventKeyboard ¶
EventKeyboard data is generated by the system keyboard.
type EventMouseButton ¶
type EventMouseButton struct { Button MouseButton Down bool }
EventMouseButton data is generated by any of the system mouse buttons.
type EventMouseMotion ¶
type EventMouseMotion struct { // x and y values should be between -1.0 and 1.0 X float32 Y float32 }
EventMouseMotion data is generated by the motion of the system mouse.
type EventMouseWheel ¶ added in v0.15.0
type EventMouseWheel struct {
Delta float32
}
EventMouseWheel data is generated by the mouse wheel (jog wheel).
type EventQuit ¶
type EventQuit struct{}
EventQuit is sent, for example, when the GUI window is closed.
type GamepadButton ¶
type GamepadButton int
GamepadButton identifies a gamepad button.
const ( GamepadButtonNone GamepadButton = iota GamepadButtonBack GamepadButtonStart GamepadButtonA GamepadButtonBumperLeft GamepadButtonBumperRight GamepadButtonGuide )
List of valid GamepadButtons.
type GamepadThumbstick ¶
type GamepadThumbstick int
GamepadThumbstick identifies the gamepad thumbstick.
const ( GamepadThumbstickLeft GamepadThumbstick = iota GamepadThumbstickRight )
List of GamepadAxis values.
type GamepadTrigger ¶
type GamepadTrigger int
GamepadTrigger identifies the gamepad triggers.
const ( GamepadTriggerNone GamepadTrigger = iota GamepadTriggerLeft GamepadTriggerRight )
List of GamepadTrigger values.
type HandleInput ¶
type HandleInput interface { // HandleEvent forwards the Event and EventData to the device connected to the // specified PortID. // // Returns true if the port understood and handled the event. HandleEvent(id plugging.PortID, ev ports.Event, d ports.EventData) (bool, error) // PeripheralID identifies the device currently attached to the port. PeripheralID(id plugging.PortID) plugging.PeripheralID }
HandleInput conceptualises data being sent to the console ports.
type MouseButton ¶
type MouseButton int
MouseButton identifies the mouse button.
const ( MouseButtonNone MouseButton = iota MouseButtonLeft MouseButtonRight MouseButtonMiddle )
List of valid MouseButtonIDs.