libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerLEDMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include "ControllerMapping.h"
6#include "ship/utils/color.h"
7
8namespace Ship {
9
10#define LED_COLOR_SOURCE_OFF 0
11#define LED_COLOR_SOURCE_SET 1
12#define LED_COLOR_SOURCE_GAME 2
13
22 public:
30 ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t colorSource,
31 Color_RGB8 savedColor);
33
38 void SetColorSource(uint8_t colorSource);
39
44 uint8_t GetColorSource();
45
50 virtual void SetLEDColor(Color_RGB8 color) = 0;
51
56 void SetSavedColor(Color_RGB8 colorToSave);
57
63
68 void SetPortIndex(uint8_t portIndex);
69
74 virtual std::string GetLEDMappingId() = 0;
75
77 virtual void SaveToConfig() = 0;
78
80 virtual void EraseFromConfig() = 0;
81
82 protected:
83 uint8_t mPortIndex;
84 uint8_t mColorSource;
86};
87} // namespace Ship
Maps LED colour output to a physical controller.
Definition ControllerLEDMapping.h:21
virtual std::string GetLEDMappingId()=0
Returns a unique string identifier for this LED mapping.
void SetSavedColor(Color_RGB8 colorToSave)
Saves a colour for later restoration.
virtual void SetLEDColor(Color_RGB8 color)=0
Applies the given colour to the physical device LED.
uint8_t GetColorSource()
Returns the current LED colour source mode.
Color_RGB8 GetSavedColor()
Returns the previously saved LED colour.
void SetPortIndex(uint8_t portIndex)
Sets the controller port index for this mapping.
Color_RGB8 mSavedColor
Definition ControllerLEDMapping.h:85
virtual void EraseFromConfig()=0
Removes this mapping from the application configuration.
void SetColorSource(uint8_t colorSource)
Sets the LED colour source mode.
uint8_t mPortIndex
Definition ControllerLEDMapping.h:83
uint8_t mColorSource
Definition ControllerLEDMapping.h:84
virtual void SaveToConfig()=0
Persists this mapping to the application configuration.
ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t colorSource, Color_RGB8 savedColor)
Constructs a ControllerLEDMapping.
Base class for all controller mappings.
Definition ControllerMapping.h:20
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