userinput

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2021 License: GPL-3.0, GPL-3.0 Imports: 2 Imported by: 0

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

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 is a Quit event and False otherwise.

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

type EventKeyboard struct {
	Key  string
	Down bool
	Mod  KeyMod
}

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 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
)

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(id plugging.PortID, ev ports.Event, d ports.EventData) error
}

HandleInput conceptualises data being sent to the console ports.

type KeyMod

type KeyMod int

KeyMod identifies.

const (
	KeyModNone KeyMod = iota
	KeyModShift
	KeyModCtrl
	KeyModAlt
)

list of valud key modifiers.

type MouseButton

type MouseButton int

MouseButton identifies the mouse button.

const (
	MouseButtonNone MouseButton = iota
	MouseButtonLeft
	MouseButtonRight
	MouseButtonMiddle
)

List of valid MouseButtonIDs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL