libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControlPort.h
Go to the documentation of this file.
1#pragma once
2
4#include "ship/controller/controldevice/controller/Controller.h"
5#include <memory>
6
7namespace Ship {
16 public:
21 ControlPort(uint8_t portIndex);
22
28 ControlPort(uint8_t portIndex, std::shared_ptr<ControlDevice> device);
30
35 void Connect(std::shared_ptr<ControlDevice> device);
36
38 void Disconnect();
39
43 std::shared_ptr<ControlDevice> GetConnectedDevice();
44
50 std::shared_ptr<Controller> GetConnectedController();
51
52 private:
53 uint8_t mPortIndex;
54 std::shared_ptr<ControlDevice> mDevice;
55};
56} // namespace Ship
Represents a single physical controller port on the console.
Definition ControlPort.h:15
void Connect(std::shared_ptr< ControlDevice > device)
Attaches a device to this port, replacing any previously connected device.
std::shared_ptr< ControlDevice > GetConnectedDevice()
Returns the device connected to this port, or nullptr if the port is empty.
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.
void Disconnect()
Detaches any device currently connected to this port.
std::shared_ptr< Controller > GetConnectedController()
Returns the connected device cast to Controller, or nullptr.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14