|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Represents a single physical controller port on the console. More...
#include <ControlPort.h>
Public Member Functions | |
| ControlPort (uint8_t portIndex) | |
| Constructs an empty port with no device attached. | |
| ControlPort (uint8_t portIndex, std::shared_ptr< ControlDevice > device) | |
| Constructs a port with an initial device already connected. | |
| ~ControlPort () | |
| void | Connect (std::shared_ptr< ControlDevice > device) |
| Attaches a device to this port, replacing any previously connected device. | |
| void | Disconnect () |
| Detaches any device currently connected to this port. | |
| std::shared_ptr< ControlDevice > | GetConnectedDevice () |
| Returns the device connected to this port, or nullptr if the port is empty. | |
| std::shared_ptr< Controller > | GetConnectedController () |
| Returns the connected device cast to Controller, or nullptr. | |
Represents a single physical controller port on the console.
A ControlPort holds a reference to the ControlDevice (usually a Controller) currently connected to it, or nullptr when the port is empty. It is owned by ControlDeck and indexed from 0.
| Ship::ControlPort::ControlPort | ( | uint8_t | portIndex | ) |
Constructs an empty port with no device attached.
| portIndex | Zero-based port index. |
| Ship::ControlPort::ControlPort | ( | uint8_t | portIndex, |
| std::shared_ptr< ControlDevice > | device | ||
| ) |
Constructs a port with an initial device already connected.
| portIndex | Zero-based port index. |
| device | Device to connect immediately. |
| Ship::ControlPort::~ControlPort | ( | ) |
| void Ship::ControlPort::Connect | ( | std::shared_ptr< ControlDevice > | device | ) |
Attaches a device to this port, replacing any previously connected device.
| device | Device to connect; pass nullptr to disconnect. |
| void Ship::ControlPort::Disconnect | ( | ) |
Detaches any device currently connected to this port.
| std::shared_ptr< Controller > Ship::ControlPort::GetConnectedController | ( | ) |
Returns the connected device cast to Controller, or nullptr.
Convenience wrapper around GetConnectedDevice() that performs a dynamic cast.
| std::shared_ptr< ControlDevice > Ship::ControlPort::GetConnectedDevice | ( | ) |
Returns the device connected to this port, or nullptr if the port is empty.