@kmamal/sdl 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -186,15 +186,17 @@ const handleEvents = () => {
|
|
|
186
186
|
const { joystickId } = event
|
|
187
187
|
delete event.joystickId
|
|
188
188
|
|
|
189
|
-
{
|
|
189
|
+
closeJoysticks: {
|
|
190
190
|
const collection = Globals.joystickInstances.byId.get(joystickId)
|
|
191
|
+
if (!collection) { break closeJoysticks }
|
|
191
192
|
for (const joystickInstance of collection.values()) {
|
|
192
193
|
joystickInstance.close()
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
{
|
|
197
|
+
closeControllers: {
|
|
197
198
|
const collection = Globals.controllerInstances.byId.get(joystickId)
|
|
199
|
+
if (!collection) { break closeControllers }
|
|
198
200
|
for (const controllerInstance of collection.values()) {
|
|
199
201
|
controllerInstance.close()
|
|
200
202
|
}
|
|
@@ -690,6 +690,12 @@ enum_getControllerButtons (Variant & buttons)
|
|
|
690
690
|
ErrorMessage *
|
|
691
691
|
initialize (Variant & object)
|
|
692
692
|
{
|
|
693
|
+
// Hints
|
|
694
|
+
{
|
|
695
|
+
SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "0");
|
|
696
|
+
SDL_SetHint(SDL_HINT_XINPUT_ENABLED, "0");
|
|
697
|
+
}
|
|
698
|
+
|
|
693
699
|
MAKE_MAP(object);
|
|
694
700
|
|
|
695
701
|
// Init
|
|
@@ -704,11 +710,6 @@ initialize (Variant & object)
|
|
|
704
710
|
}
|
|
705
711
|
}
|
|
706
712
|
|
|
707
|
-
// Hints
|
|
708
|
-
{
|
|
709
|
-
SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "0");
|
|
710
|
-
}
|
|
711
|
-
|
|
712
713
|
// Version
|
|
713
714
|
{
|
|
714
715
|
Variant version, compile, runtime;
|
|
@@ -2111,7 +2112,9 @@ joystick_rumble (
|
|
|
2111
2112
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2112
2113
|
}
|
|
2113
2114
|
|
|
2114
|
-
SDL_JoystickRumble(joystick, low_freq_rumble * 0xFFFF, high_freq_rumble * 0xFFFF, duration)
|
|
2115
|
+
if (SDL_JoystickRumble(joystick, low_freq_rumble * 0xFFFF, high_freq_rumble * 0xFFFF, duration) == -1) {
|
|
2116
|
+
RETURN_ERROR("SDL_JoystickRumble(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2117
|
+
}
|
|
2115
2118
|
|
|
2116
2119
|
return nullptr;
|
|
2117
2120
|
}
|
|
@@ -2124,7 +2127,9 @@ joystick_setLed (int joystick_id, double red, double green, double blue)
|
|
|
2124
2127
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2125
2128
|
}
|
|
2126
2129
|
|
|
2127
|
-
SDL_JoystickSetLED(joystick, red * 0xFF, green * 0xFF, blue * 0xFF)
|
|
2130
|
+
if (SDL_JoystickSetLED(joystick, red * 0xFF, green * 0xFF, blue * 0xFF) == -1) {
|
|
2131
|
+
RETURN_ERROR("SDL_JoystickSetLED(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2132
|
+
}
|
|
2128
2133
|
|
|
2129
2134
|
return nullptr;
|
|
2130
2135
|
}
|
|
@@ -2154,7 +2159,9 @@ joystick_rumbleTriggers (
|
|
|
2154
2159
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2155
2160
|
}
|
|
2156
2161
|
|
|
2157
|
-
SDL_JoystickRumbleTriggers(joystick, left_rumble * 0xFFFF, right_rumble * 0xFFFF, duration)
|
|
2162
|
+
if (SDL_JoystickRumbleTriggers(joystick, left_rumble * 0xFFFF, right_rumble * 0xFFFF, duration) == -1) {
|
|
2163
|
+
RETURN_ERROR("SDL_JoystickRumbleTriggers(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2164
|
+
}
|
|
2158
2165
|
|
|
2159
2166
|
return nullptr;
|
|
2160
2167
|
}
|