@kmamal/sdl 0.7.5 → 0.7.6
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
|
}
|
|
@@ -2111,7 +2111,9 @@ joystick_rumble (
|
|
|
2111
2111
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2112
2112
|
}
|
|
2113
2113
|
|
|
2114
|
-
SDL_JoystickRumble(joystick, low_freq_rumble * 0xFFFF, high_freq_rumble * 0xFFFF, duration)
|
|
2114
|
+
if (SDL_JoystickRumble(joystick, low_freq_rumble * 0xFFFF, high_freq_rumble * 0xFFFF, duration) == -1) {
|
|
2115
|
+
RETURN_ERROR("SDL_JoystickRumble(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2116
|
+
}
|
|
2115
2117
|
|
|
2116
2118
|
return nullptr;
|
|
2117
2119
|
}
|
|
@@ -2124,7 +2126,9 @@ joystick_setLed (int joystick_id, double red, double green, double blue)
|
|
|
2124
2126
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2125
2127
|
}
|
|
2126
2128
|
|
|
2127
|
-
SDL_JoystickSetLED(joystick, red * 0xFF, green * 0xFF, blue * 0xFF)
|
|
2129
|
+
if (SDL_JoystickSetLED(joystick, red * 0xFF, green * 0xFF, blue * 0xFF) == -1) {
|
|
2130
|
+
RETURN_ERROR("SDL_JoystickSetLED(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2131
|
+
}
|
|
2128
2132
|
|
|
2129
2133
|
return nullptr;
|
|
2130
2134
|
}
|
|
@@ -2154,7 +2158,9 @@ joystick_rumbleTriggers (
|
|
|
2154
2158
|
RETURN_ERROR("SDL_JoystickFromInstanceID(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2155
2159
|
}
|
|
2156
2160
|
|
|
2157
|
-
SDL_JoystickRumbleTriggers(joystick, left_rumble * 0xFFFF, right_rumble * 0xFFFF, duration)
|
|
2161
|
+
if (SDL_JoystickRumbleTriggers(joystick, left_rumble * 0xFFFF, right_rumble * 0xFFFF, duration) == -1) {
|
|
2162
|
+
RETURN_ERROR("SDL_JoystickRumbleTriggers(%d) error: %s\n", joystick_id, SDL_GetError());
|
|
2163
|
+
}
|
|
2158
2164
|
|
|
2159
2165
|
return nullptr;
|
|
2160
2166
|
}
|