controllers

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package controllers contains the implementations for all the emulated controllers for the VCS.

The Auto type handles flipping of the other controller types according to user input and the state of the machine. The Auto type will forward all functions to the "real" controller (ie. the stick, paddle or keyboard) transparently. So for example, ID() will return the ID() of the "real" controller. If you really need to know whether the real controller has been automatically selected via the Auto type then you can (test the Player 0 port, for example):

if _, ok := ports.Player0.(controllers.Auto); ok {
	// is auto
} else {
	// is not auto
}

Index

Constants

This section is empty.

Variables

View Source
var ControllerList = []string{"Stick", "Paddle", "Keyboard"}

ControllerList is the list of controllers. These are the values that can be returned by the ID() function of the ports.Peripheral implementations in this package.

Functions

func NewAuto

NewAuto is the preferred method of initialisation for the Auto type. Satisifies the ports.NewPeripheral interface and can be used as an argument to ports.AttachPlayer0() and ports.AttachPlayer1().

func NewKeypad added in v0.14.0

func NewKeypad(port plugging.PortID, bus ports.PeripheralBus) ports.Peripheral

NewKeypad is the preferred method of initialisation for the Keyboard type Satisifies the ports.NewPeripheral interface and can be used as an argument to ports.AttachPlayer0() and ports.AttachPlayer1().

func NewPaddle

func NewPaddle(port plugging.PortID, bus ports.PeripheralBus) ports.Peripheral

NewPaddle is the preferred method of initialisation for the Paddle type Satisifies the ports.NewPeripheral interface and can be used as an argument to ports.AttachPlayer0() and ports.AttachPlayer1().

func NewStick

func NewStick(port plugging.PortID, bus ports.PeripheralBus) ports.Peripheral

NewStick is the preferred method of initialisation for the Stick type Satisifies the ports.NewPeripheral interface and can be used as an argument to ports.AttachPlayer0() and ports.AttachPlayer1().

Types

type Auto

type Auto struct {
	// contains filtered or unexported fields
}

Auto handles the automatic switching between controller types.

func (*Auto) AttachPlugMonitor added in v0.10.1

func (aut *Auto) AttachPlugMonitor(m plugging.PlugMonitor)

AttachPlugMonitor implements the plugging.Monitorable interface.

func (*Auto) HandleEvent

func (aut *Auto) HandleEvent(event ports.Event, data ports.EventData) error

HandleEvent implements the ports.Peripheral interface.

func (*Auto) ID added in v0.14.0

func (aut *Auto) ID() plugging.PeripheralID

ID implements the ports.Peripheral interface.

func (*Auto) Plumb

func (aut *Auto) Plumb(bus ports.PeripheralBus)

Plumb implements the Peripheral interface.

func (*Auto) PortID added in v0.10.1

func (aut *Auto) PortID() plugging.PortID

PortID implements the ports.Peripheral interface.

func (*Auto) Reset

func (aut *Auto) Reset()

Reset implements the ports.Peripheral interface.

func (*Auto) Step

func (aut *Auto) Step()

Step implements the ports.Peripheral interface.

func (*Auto) String

func (aut *Auto) String() string

String implements the ports.Peripheral interface.

func (*Auto) Update

func (aut *Auto) Update(data bus.ChipData) bool

Update implements the ports.Peripheral interface.

type Keypad added in v0.14.0

type Keypad struct {
	// contains filtered or unexported fields
}

Keypad represents the VCS keypad type.

func (*Keypad) HandleEvent added in v0.14.0

func (key *Keypad) HandleEvent(event ports.Event, data ports.EventData) error

HandleEvent implements the ports.Peripheral interface.

func (*Keypad) ID added in v0.14.0

func (key *Keypad) ID() plugging.PeripheralID

ID implements the ports.Peripheral interface.

func (*Keypad) Plumb added in v0.14.0

func (key *Keypad) Plumb(bus ports.PeripheralBus)

Plumb implements the ports.Peripheral interface.

func (*Keypad) PortID added in v0.14.0

func (key *Keypad) PortID() plugging.PortID

PortID implements the ports.Peripheral interface.

func (*Keypad) Reset added in v0.14.0

func (key *Keypad) Reset()

Reset implements the ports.Peripheral interface.

func (*Keypad) Step added in v0.14.0

func (key *Keypad) Step()

Step implements the ports.Peripheral interface.

func (*Keypad) String added in v0.14.0

func (key *Keypad) String() string

String implements the ports.Peripheral interface.

func (*Keypad) Update added in v0.14.0

func (key *Keypad) Update(data bus.ChipData) bool

Update implements the ports.Peripheral interface.

type Paddle

type Paddle struct {
	// contains filtered or unexported fields
}

Paddle represents the VCS paddle controller type.

func (*Paddle) HandleEvent

func (pdl *Paddle) HandleEvent(event ports.Event, data ports.EventData) error

HandleEvent implements the ports.Peripheral interface.

func (*Paddle) ID added in v0.14.0

func (pdl *Paddle) ID() plugging.PeripheralID

ID implements the ports.Peripheral interface.

func (*Paddle) Plumb

func (pdl *Paddle) Plumb(bus ports.PeripheralBus)

Plumb implements the ports.Peripheral interface.

func (*Paddle) PortID added in v0.10.1

func (pdl *Paddle) PortID() plugging.PortID

PortID implements the ports.Peripheral interface.

func (*Paddle) Reset

func (pdl *Paddle) Reset()

Reset implements the ports.Peripheral interface.

func (*Paddle) Step

func (pdl *Paddle) Step()

Step implements the ports.Peripheral interface.

func (*Paddle) String

func (pdl *Paddle) String() string

String implements the ports.Peripheral interface.

func (*Paddle) Update

func (pdl *Paddle) Update(data bus.ChipData) bool

Update implements the ports.Peripheral interface.

type Stick

type Stick struct {
	// contains filtered or unexported fields
}

Stick represents the VCS digital joystick controller.

func (*Stick) HandleEvent

func (stk *Stick) HandleEvent(event ports.Event, data ports.EventData) error

HandleEvent implements the ports.Peripheral interface.

func (*Stick) ID added in v0.14.0

func (stk *Stick) ID() plugging.PeripheralID

ID implements the ports.Peripheral interface.

func (*Stick) Plumb

func (stk *Stick) Plumb(bus ports.PeripheralBus)

Plumb implements the ports.Peripheral interface.

func (*Stick) PortID added in v0.10.1

func (stk *Stick) PortID() plugging.PortID

PortID implements the ports.Peripheral interface.

func (*Stick) Reset

func (stk *Stick) Reset()

Reset implements the ports.Peripheral interface.

func (*Stick) Step

func (stk *Stick) Step()

Step implements the ports.Peripheral interface.

func (*Stick) String

func (stk *Stick) String() string

String implements the ports.Peripheral interface.

func (*Stick) Update

func (stk *Stick) Update(data bus.ChipData) bool

Update implements the ports.Peripheral interface.

Jump to

Keyboard shortcuts

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