libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerRumbleMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include "ControllerMapping.h"
6
7namespace Ship {
8
9#define DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE 50
10#define DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE 50
11
19 public:
27 ControllerRumbleMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex,
28 uint8_t lowFrequencyIntensityPercentage, uint8_t highFrequencyIntensityPercentage);
30
32 virtual void StartRumble() = 0;
33
35 virtual void StopRumble() = 0;
36
41 virtual void SetLowFrequencyIntensity(uint8_t intensityPercentage);
42
47 virtual void SetHighFrequencyIntensity(uint8_t intensityPercentage);
48
54
60
66
72
75
78
83 void SetPortIndex(uint8_t portIndex);
84
89 virtual std::string GetRumbleMappingId() = 0;
90
92 virtual void SaveToConfig() = 0;
93
95 virtual void EraseFromConfig() = 0;
96
97 protected:
98 uint8_t mPortIndex;
99
102};
103} // namespace Ship
Base class for all controller mappings.
Definition ControllerMapping.h:20
Maps rumble (haptic feedback) output to a physical controller.
Definition ControllerRumbleMapping.h:18
ControllerRumbleMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t lowFrequencyIntensityPercentage, uint8_t highFrequencyIntensityPercentage)
Constructs a ControllerRumbleMapping.
uint8_t mLowFrequencyIntensityPercentage
Definition ControllerRumbleMapping.h:100
uint8_t mHighFrequencyIntensityPercentage
Definition ControllerRumbleMapping.h:101
virtual void StopRumble()=0
Deactivates rumble on the physical device.
uint8_t GetLowFrequencyIntensityPercentage()
Returns the current low-frequency rumble intensity percentage.
void ResetHighFrequencyIntensityToDefault()
Resets high-frequency rumble intensity to DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE.
virtual void SaveToConfig()=0
Persists this mapping to the application configuration.
bool HighFrequencyIntensityIsDefault()
Checks whether the high-frequency intensity is at its default value.
virtual std::string GetRumbleMappingId()=0
Returns a unique string identifier for this rumble mapping.
virtual void EraseFromConfig()=0
Removes this mapping from the application configuration.
virtual void StartRumble()=0
Activates rumble on the physical device.
bool LowFrequencyIntensityIsDefault()
Checks whether the low-frequency intensity is at its default value.
virtual void SetLowFrequencyIntensity(uint8_t intensityPercentage)
Sets the low-frequency rumble intensity.
uint8_t GetHighFrequencyIntensityPercentage()
Returns the current high-frequency rumble intensity percentage.
void ResetLowFrequencyIntensityToDefault()
Resets low-frequency rumble intensity to DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE.
virtual void SetHighFrequencyIntensity(uint8_t intensityPercentage)
Sets the high-frequency rumble intensity.
void SetPortIndex(uint8_t portIndex)
Sets the controller port index for this mapping.
uint8_t mPortIndex
Definition ControllerRumbleMapping.h:98
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