libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerLED.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <unordered_map>
6#include <string>
7
9
10namespace Ship {
11class ConsoleVariable;
12class ControlDeck;
23 public:
25 void SetControlDeck(std::shared_ptr<ControlDeck> controlDeck) {
26 mControlDeck = std::move(controlDeck);
27 }
32 ControllerLED(uint8_t portIndex, std::shared_ptr<ConsoleVariable> consoleVariable = nullptr,
33 std::shared_ptr<ControlDeck> controlDeck = nullptr);
35
39 std::unordered_map<std::string, std::shared_ptr<ControllerLEDMapping>> GetAllLEDMappings();
40
45 void AddLEDMapping(std::shared_ptr<ControllerLEDMapping> mapping);
46
51 void ClearLEDMappingId(std::string id);
52
57 void ClearLEDMapping(std::string id);
58
61
64
70
75 void LoadLEDMappingFromConfig(std::string id);
76
79
85
91
97
98 private:
99 uint8_t mPortIndex;
100 std::unordered_map<std::string, std::shared_ptr<ControllerLEDMapping>> mLEDMappings;
101 std::shared_ptr<ConsoleVariable> mConsoleVariable;
102 std::shared_ptr<ControlDeck> mControlDeck;
103};
104} // namespace Ship
Aggregates LED output mappings and drives controller lighting hardware.
Definition ControllerLED.h:22
void LoadLEDMappingFromConfig(std::string id)
Loads the mapping with id from Config and adds it to the collection.
void ClearLEDMapping(std::string id)
Removes the mapping with id from both in-memory and Config.
ControllerLED(uint8_t portIndex, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< ControlDeck > controlDeck=nullptr)
Constructs a ControllerLED for the given port.
void ClearAllMappingsForDeviceType(PhysicalDeviceType physicalDeviceType)
Removes all mappings that target the given device type.
void ClearAllMappings()
Removes all in-memory LED mappings.
void SetLEDColor(Color_RGB8 color)
Sends color to all mapped physical devices.
void SetControlDeck(std::shared_ptr< ControlDeck > controlDeck)
Injects the owning ControlDeck.
Definition ControllerLED.h:25
void ClearLEDMappingId(std::string id)
Removes the mapping ID from Config without destroying the in-memory object.
bool AddLEDMappingFromRawPress()
Listens for the next raw physical input and creates an LED mapping from it.
bool HasMappingsForPhysicalDeviceType(PhysicalDeviceType physicalDeviceType)
Returns true if any mapping targets the given device type.
std::unordered_map< std::string, std::shared_ptr< ControllerLEDMapping > > GetAllLEDMappings()
Returns a copy of the full id → mapping map.
void SaveLEDMappingIdsToConfig()
Writes the current set of mapping IDs to Config.
void AddLEDMapping(std::shared_ptr< ControllerLEDMapping > mapping)
Adds an LED mapping to the collection.
void ReloadAllMappingsFromConfig()
Clears all in-memory mappings and reloads them from Config.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
PhysicalDeviceType
Identifies the category of a physical input device.
Definition PhysicalDeviceType.h:11
8-bit RGB colour without an alpha channel.
Definition color.h:14