Skip to content

Commit e5babe3

Browse files
committed
clang format
1 parent d674cf8 commit e5babe3

26 files changed

+84
-65
lines changed

src/controller/controldevice/controller/Controller.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ std::shared_ptr<ControllerButton> Controller::GetButtonByBitmask(CONTROLLERBUTTO
175175
return mButtons[bitmask];
176176
}
177177

178-
void Controller::MoveMappingsToDifferentController(std::shared_ptr<Controller> newController, PhysicalDeviceType lusIndex) {
178+
void Controller::MoveMappingsToDifferentController(std::shared_ptr<Controller> newController,
179+
PhysicalDeviceType lusIndex) {
179180
// todo: remove this entirely
180181
return;
181182
}

src/controller/controldevice/controller/ControllerStick.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void ControllerStick::AddAxisDirectionMapping(Direction direction,
127127
void ControllerStick::AddDefaultMappings(PhysicalDeviceType physicalDeviceType) {
128128
if (physicalDeviceType == PhysicalDeviceType::SDLGamepad) {
129129
for (auto mapping :
130-
AxisDirectionMappingFactory::CreateDefaultSDLAxisDirectionMappings(mPortIndex, mStickIndex)) {
130+
AxisDirectionMappingFactory::CreateDefaultSDLAxisDirectionMappings(mPortIndex, mStickIndex)) {
131131
AddAxisDirectionMapping(mapping->GetDirection(), mapping);
132132
}
133133
}
@@ -452,7 +452,8 @@ bool ControllerStick::HasMappingsForPhysicalDeviceType(PhysicalDeviceType physic
452452
[physicalDeviceType](const auto& directionMappings) {
453453
return std::any_of(directionMappings.second.begin(), directionMappings.second.end(),
454454
[physicalDeviceType](const auto& mappingPair) {
455-
return mappingPair.second->GetPhysicalDeviceType() == physicalDeviceType;
455+
return mappingPair.second->GetPhysicalDeviceType() ==
456+
physicalDeviceType;
456457
});
457458
});
458459
}

src/controller/controldevice/controller/mapping/ControllerAxisDirectionMapping.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
namespace Ship {
77
ControllerAxisDirectionMapping::ControllerAxisDirectionMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex,
88
StickIndex stickIndex, Direction direction)
9-
: ControllerInputMapping(physicalDeviceType), mPortIndex(portIndex), mStickIndex(stickIndex), mDirection(direction) {
9+
: ControllerInputMapping(physicalDeviceType), mPortIndex(portIndex), mStickIndex(stickIndex),
10+
mDirection(direction) {
1011
}
1112

1213
ControllerAxisDirectionMapping::~ControllerAxisDirectionMapping() {

src/controller/controldevice/controller/mapping/ControllerGyroMapping.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "ControllerGyroMapping.h"
22

33
namespace Ship {
4-
ControllerGyroMapping::ControllerGyroMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, float sensitivity)
4+
ControllerGyroMapping::ControllerGyroMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex,
5+
float sensitivity)
56
: ControllerInputMapping(physicalDeviceType), mPortIndex(portIndex), mSensitivity(sensitivity) {
67
mSensitivityPercent = mSensitivity * 100;
78
}

src/controller/controldevice/controller/mapping/ControllerInputMapping.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "ControllerInputMapping.h"
22

33
namespace Ship {
4-
ControllerInputMapping::ControllerInputMapping(PhysicalDeviceType physicalDeviceType) : ControllerMapping(physicalDeviceType) {
4+
ControllerInputMapping::ControllerInputMapping(PhysicalDeviceType physicalDeviceType)
5+
: ControllerMapping(physicalDeviceType) {
56
}
67

78
ControllerInputMapping::~ControllerInputMapping() {

src/controller/controldevice/controller/mapping/ControllerLEDMapping.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "ControllerLEDMapping.h"
22

33
namespace Ship {
4-
ControllerLEDMapping::ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t colorSource,
5-
Color_RGB8 savedColor)
4+
ControllerLEDMapping::ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex,
5+
uint8_t colorSource, Color_RGB8 savedColor)
66
: ControllerMapping(physicalDeviceType), mPortIndex(portIndex), mColorSource(colorSource), mSavedColor(savedColor) {
77
}
88

src/controller/controldevice/controller/mapping/ControllerLEDMapping.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace Ship {
1313

1414
class ControllerLEDMapping : public ControllerMapping {
1515
public:
16-
ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t colorSource, Color_RGB8 savedColor);
16+
ControllerLEDMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t colorSource,
17+
Color_RGB8 savedColor);
1718
~ControllerLEDMapping();
1819

1920
void SetColorSource(uint8_t colorSource);

src/controller/controldevice/controller/mapping/ControllerRumbleMapping.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ namespace Ship {
1111

1212
class ControllerRumbleMapping : public ControllerMapping {
1313
public:
14-
ControllerRumbleMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, uint8_t lowFrequencyIntensityPercentage,
15-
uint8_t highFrequencyIntensityPercentage);
14+
ControllerRumbleMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex,
15+
uint8_t lowFrequencyIntensityPercentage, uint8_t highFrequencyIntensityPercentage);
1616
~ControllerRumbleMapping();
1717
virtual void StartRumble() = 0;
1818
virtual void StopRumble() = 0;

src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ AxisDirectionMappingFactory::CreateDefaultKeyboardAxisDirectionMappings(uint8_t
123123
}
124124

125125
std::vector<std::shared_ptr<ControllerAxisDirectionMapping>>
126-
AxisDirectionMappingFactory::CreateDefaultSDLAxisDirectionMappings(uint8_t portIndex,
127-
StickIndex stickIndex) {
126+
AxisDirectionMappingFactory::CreateDefaultSDLAxisDirectionMappings(uint8_t portIndex, StickIndex stickIndex) {
128127
std::vector<std::shared_ptr<ControllerAxisDirectionMapping>> mappings = {
129128
std::make_shared<SDLAxisDirectionToAxisDirectionMapping>(portIndex, stickIndex, LEFT,
130129
stickIndex == LEFT_STICK ? 0 : 2, -1),
@@ -144,7 +143,9 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromSDLInput(uint8_t port
144143
Direction direction) {
145144
std::shared_ptr<ControllerAxisDirectionMapping> mapping = nullptr;
146145

147-
for (auto [lusIndex, controller] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(portIndex)) {
146+
for (auto [lusIndex, controller] :
147+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
148+
portIndex)) {
148149
for (int32_t button = SDL_CONTROLLER_BUTTON_A; button < SDL_CONTROLLER_BUTTON_MAX; button++) {
149150
if (SDL_GameControllerGetButton(controller, static_cast<SDL_GameControllerButton>(button))) {
150151
mapping = std::make_shared<SDLButtonToAxisDirectionMapping>(portIndex, stickIndex, direction, button);

src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ std::shared_ptr<ControllerButtonMapping>
214214
ButtonMappingFactory::CreateButtonMappingFromSDLInput(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask) {
215215
std::shared_ptr<ControllerButtonMapping> mapping = nullptr;
216216

217-
for (auto [lusIndex, controller] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(portIndex)) {
217+
for (auto [lusIndex, controller] :
218+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
219+
portIndex)) {
218220
for (int32_t button = SDL_CONTROLLER_BUTTON_A; button < SDL_CONTROLLER_BUTTON_MAX; button++) {
219221
if (SDL_GameControllerGetButton(controller, static_cast<SDL_GameControllerButton>(button))) {
220222
mapping = std::make_shared<SDLButtonToButtonMapping>(portIndex, bitmask, button);

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ std::string SDLAxisDirectionToAnyMapping::GetPhysicalInputName() {
2828
return StringHelper::Sprintf("Right Stick %s",
2929
mAxisDirection == NEGATIVE ? ICON_FA_ARROW_UP : ICON_FA_ARROW_DOWN);
3030
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
31-
return "LT";
31+
return "LT";
3232
break;
3333
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
34-
return "RT";
34+
return "RT";
3535
break;
3636
default:
3737
break;

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ float SDLAxisDirectionToAxisDirectionMapping::GetNormalizedAxisDirectionValue()
2424

2525
// todo: i don't like making a vector here, not sure what a better solution is
2626
std::vector<float> normalizedValues = {};
27-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
27+
for (const auto& [instanceId, gamepad] :
28+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
29+
mPortIndex)) {
2830
const auto axisValue = SDL_GameControllerGetAxis(gamepad, mControllerAxis);
2931

3032
if ((mAxisDirection == POSITIVE && axisValue < 0) || (mAxisDirection == NEGATIVE && axisValue > 0)) {
@@ -45,8 +47,7 @@ float SDLAxisDirectionToAxisDirectionMapping::GetNormalizedAxisDirectionValue()
4547
}
4648

4749
std::string SDLAxisDirectionToAxisDirectionMapping::GetAxisDirectionMappingId() {
48-
return StringHelper::Sprintf("P%d-S%d-D%d-SDLA%d-AD%s", mPortIndex, mStickIndex, mDirection,
49-
mControllerAxis,
50+
return StringHelper::Sprintf("P%d-S%d-D%d-SDLA%d-AD%s", mPortIndex, mStickIndex, mDirection, mControllerAxis,
5051
mAxisDirection == 1 ? "P" : "N");
5152
}
5253

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ void SDLAxisDirectionToButtonMapping::UpdatePad(CONTROLLERBUTTONS_T& padButtons)
3434
// }
3535
// }
3636

37-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
37+
for (const auto& [instanceId, gamepad] :
38+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
39+
mPortIndex)) {
3840
const auto axisValue = SDL_GameControllerGetAxis(gamepad, mControllerAxis);
3941

4042
auto axisMinValue = SDL_JOYSTICK_AXIS_MAX * (axisThresholdPercentage / 100.0f);
@@ -50,8 +52,7 @@ int8_t SDLAxisDirectionToButtonMapping::GetMappingType() {
5052
}
5153

5254
std::string SDLAxisDirectionToButtonMapping::GetButtonMappingId() {
53-
return StringHelper::Sprintf("P%d-B%d-SDLA%d-AD%s", mPortIndex, mBitmask,
54-
mControllerAxis,
55+
return StringHelper::Sprintf("P%d-B%d-SDLA%d-AD%s", mPortIndex, mBitmask, mControllerAxis,
5556
mAxisDirection == 1 ? "P" : "N");
5657
}
5758

src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ float SDLButtonToAxisDirectionMapping::GetNormalizedAxisDirectionValue() {
1919
if (Context::GetInstance()->GetControlDeck()->GamepadGameInputBlocked()) {
2020
return 0.0f;
2121
}
22-
23-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
22+
23+
for (const auto& [instanceId, gamepad] :
24+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
25+
mPortIndex)) {
2426
if (SDL_GameControllerGetButton(gamepad, mControllerButton)) {
2527
return MAX_AXIS_RANGE;
2628
}
@@ -30,8 +32,7 @@ float SDLButtonToAxisDirectionMapping::GetNormalizedAxisDirectionValue() {
3032
}
3133

3234
std::string SDLButtonToAxisDirectionMapping::GetAxisDirectionMappingId() {
33-
return StringHelper::Sprintf("P%d-S%d-D%d-SDLB%d", mPortIndex, mStickIndex, mDirection,
34-
mControllerButton);
35+
return StringHelper::Sprintf("P%d-S%d-D%d-SDLB%d", mPortIndex, mStickIndex, mDirection, mControllerButton);
3536
}
3637

3738
void SDLButtonToAxisDirectionMapping::SaveToConfig() {

src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ void SDLButtonToButtonMapping::UpdatePad(CONTROLLERBUTTONS_T& padButtons) {
1616
if (Context::GetInstance()->GetControlDeck()->GamepadGameInputBlocked()) {
1717
return;
1818
}
19-
20-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
19+
20+
for (const auto& [instanceId, gamepad] :
21+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
22+
mPortIndex)) {
2123
if (SDL_GameControllerGetButton(gamepad, mControllerButton)) {
2224
padButtons |= mBitmask;
2325
return;
@@ -30,8 +32,7 @@ int8_t SDLButtonToButtonMapping::GetMappingType() {
3032
}
3133

3234
std::string SDLButtonToButtonMapping::GetButtonMappingId() {
33-
return StringHelper::Sprintf("P%d-B%d-SDLB%d", mPortIndex, mBitmask,
34-
mControllerButton);
35+
return StringHelper::Sprintf("P%d-B%d-SDLB%d", mPortIndex, mBitmask, mControllerButton);
3536
}
3637

3738
void SDLButtonToButtonMapping::SaveToConfig() {

src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ namespace Ship {
1010
SDLGyroMapping::SDLGyroMapping(uint8_t portIndex, float sensitivity, float neutralPitch, float neutralYaw,
1111
float neutralRoll)
1212
: ControllerInputMapping(PhysicalDeviceType::SDLGamepad),
13-
ControllerGyroMapping(PhysicalDeviceType::SDLGamepad, portIndex, sensitivity),
14-
mNeutralPitch(neutralPitch), mNeutralYaw(neutralYaw), mNeutralRoll(neutralRoll) {
13+
ControllerGyroMapping(PhysicalDeviceType::SDLGamepad, portIndex, sensitivity), mNeutralPitch(neutralPitch),
14+
mNeutralYaw(neutralYaw), mNeutralRoll(neutralRoll) {
1515
}
1616

1717
void SDLGyroMapping::Recalibrate() {
18-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
18+
for (const auto& [instanceId, gamepad] :
19+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
20+
mPortIndex)) {
1921
// todo: gyro
2022
}
2123

@@ -36,10 +38,12 @@ void SDLGyroMapping::Recalibrate() {
3638
}
3739

3840
void SDLGyroMapping::UpdatePad(float& x, float& y) {
39-
for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
41+
for (const auto& [instanceId, gamepad] :
42+
Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(
43+
mPortIndex)) {
4044
// todo: gyro
4145
}
42-
46+
4347
// if (!ControllerLoaded() || Context::GetInstance()->GetControlDeck()->GamepadGameInputBlocked()) {
4448
// x = 0;
4549
// y = 0;

src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ SDLLEDMapping::SDLLEDMapping(uint8_t portIndex, uint8_t colorSource, Color_RGB8
99
}
1010

1111
void SDLLEDMapping::SetLEDColor(Color_RGB8 color) {
12-
// for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
13-
// todo: LED
12+
// for (const auto& [instanceId, gamepad] :
13+
// Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex))
14+
// { todo: LED
1415
// }
1516

1617
// if (!ControllerLoaded()) {

src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ SDLRumbleMapping::SDLRumbleMapping(uint8_t portIndex, uint8_t lowFrequencyIntens
1313
}
1414

1515
void SDLRumbleMapping::StartRumble() {
16-
// for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
17-
// todo: rumble
16+
// for (const auto& [instanceId, gamepad] :
17+
// Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex))
18+
// { todo: rumble
1819
// }
1920

2021
// if (!ControllerLoaded()) {
@@ -25,8 +26,9 @@ void SDLRumbleMapping::StartRumble() {
2526
}
2627

2728
void SDLRumbleMapping::StopRumble() {
28-
// for (const auto& [instanceId, gamepad] : Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex)) {
29-
// todo: rumble
29+
// for (const auto& [instanceId, gamepad] :
30+
// Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager()->GetConnectedSDLGamepadsForPort(mPortIndex))
31+
// { todo: rumble
3032
// }
3133

3234
// if (!ControllerLoaded()) {

src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ void ShipDeviceIndexMappingManager::InitializeSDLMappingsForPort(uint8_t n64port
9292

9393
// // if we didn't find a mapping for this guid, make defaults
9494
// auto lusIndex = GetLowestShipDeviceIndexWithNoAssociatedButtonOrAxisDirectionMappings();
95-
// auto deviceIndexMapping = std::make_shared<ShipDeviceIndexToSDLDeviceIndexMapping>(lusIndex, sdlIndex, guidString,
95+
// auto deviceIndexMapping = std::make_shared<ShipDeviceIndexToSDLDeviceIndexMapping>(lusIndex, sdlIndex,
96+
// guidString,
9697
// sdlControllerName, 25, 25);
9798
// mShipDeviceIndexToSDLControllerNames[lusIndex] = sdlControllerName;
9899
// deviceIndexMapping->SaveToConfig();
@@ -159,7 +160,7 @@ void ShipDeviceIndexMappingManager::InitializeMappingsSinglePlayer() {
159160

160161
// mShipDeviceIndexToPhysicalDeviceIndexMappings.clear();
161162
// for (auto sdlIndex : connectedSdlControllerIndices) {
162-
InitializeSDLMappingsForPort(0);
163+
InitializeSDLMappingsForPort(0);
163164
// }
164165
// mIsInitialized = true;
165166
}
@@ -575,7 +576,8 @@ ShipDeviceIndexMappingManager::GetShipDeviceIndexOfDisconnectedPhysicalDevice(in
575576
return shipDeviceIndex;
576577
}
577578

578-
PhysicalDeviceType ShipDeviceIndexMappingManager::GetLowestShipDeviceIndexWithNoAssociatedButtonOrAxisDirectionMappings() {
579+
PhysicalDeviceType
580+
ShipDeviceIndexMappingManager::GetLowestShipDeviceIndexWithNoAssociatedButtonOrAxisDirectionMappings() {
579581
return PhysicalDeviceType::SDLGamepad;
580582
}
581583

src/controller/deviceindex/ShipDeviceIndexToPhysicalDeviceIndexMapping.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "ShipDeviceIndexToPhysicalDeviceIndexMapping.h"
22

33
namespace Ship {
4-
ShipDeviceIndexToPhysicalDeviceIndexMapping::ShipDeviceIndexToPhysicalDeviceIndexMapping(PhysicalDeviceType physicalDeviceType)
4+
ShipDeviceIndexToPhysicalDeviceIndexMapping::ShipDeviceIndexToPhysicalDeviceIndexMapping(
5+
PhysicalDeviceType physicalDeviceType)
56
: mPhysicalDeviceType(physicalDeviceType) {
67
}
78

src/controller/deviceindex/ShipDeviceIndexToSDLDeviceIndexMapping.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Ship {
66
ShipDeviceIndexToSDLDeviceIndexMapping::ShipDeviceIndexToSDLDeviceIndexMapping(
7-
PhysicalDeviceType physicalDeviceType, int32_t sdlDeviceIndex, std::string sdlJoystickGuid, std::string sdlControllerName,
8-
int32_t stickAxisThresholdPercentage, int32_t triggerAxisThresholdPercentage)
7+
PhysicalDeviceType physicalDeviceType, int32_t sdlDeviceIndex, std::string sdlJoystickGuid,
8+
std::string sdlControllerName, int32_t stickAxisThresholdPercentage, int32_t triggerAxisThresholdPercentage)
99
: ShipDeviceIndexToPhysicalDeviceIndexMapping(physicalDeviceType), mSDLDeviceIndex(sdlDeviceIndex),
1010
mSDLJoystickGUID(sdlJoystickGuid), mSDLControllerName(sdlControllerName),
1111
mStickAxisThresholdPercentage(stickAxisThresholdPercentage),

src/controller/physicaldevice/ConnectedPhysicalDeviceManager.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ ConnectedPhysicalDeviceManager::ConnectedPhysicalDeviceManager() {
77
ConnectedPhysicalDeviceManager::~ConnectedPhysicalDeviceManager() {
88
}
99

10-
std::unordered_map<int32_t, SDL_GameController*> ConnectedPhysicalDeviceManager::GetConnectedSDLGamepadsForPort(uint8_t portIndex) {
10+
std::unordered_map<int32_t, SDL_GameController*>
11+
ConnectedPhysicalDeviceManager::GetConnectedSDLGamepadsForPort(uint8_t portIndex) {
1112
// todo: filter somehow
1213
return mConnectedSDLGamepads;
1314
}
@@ -30,7 +31,7 @@ void ConnectedPhysicalDeviceManager::RefreshConnectedSDLGamepads() {
3031

3132
auto gamepad = SDL_GameControllerOpen(i);
3233
auto instanceId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamepad));
33-
34+
3435
mConnectedSDLGamepads[instanceId] = gamepad;
3536
}
3637
}

src/controller/physicaldevice/PhysicalDeviceType.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace Ship {
44

55
#define PHYSICAL_DEVICE_TYPE_VALUES \
6-
X(Keyboard, 0) \
7-
X(Mouse, 1) \
8-
X(SDLGamepad, 2) \
6+
X(Keyboard, 0) \
7+
X(Mouse, 1) \
8+
X(SDLGamepad, 2) \
99
X(Max, 3)
1010

1111
#define X(name, value) name = value,

0 commit comments

Comments
 (0)