We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab26b5c commit 53c0310Copy full SHA for 53c0310
src_c/joystick.c
@@ -548,10 +548,19 @@ joy_set_led(PyObject *self, PyObject *arg)
548
"set_led must be passed in a Color-compatible argument");
549
}
550
551
+#if !SDL_VERSION_ATLEAST(3, 0, 0)
552
if (SDL_JoystickSetLED(joy, colors[0], colors[1], colors[2]) < 0) {
553
Py_RETURN_FALSE;
554
555
Py_RETURN_TRUE;
556
+#else
557
+ // SDL3 renames the function and sets an error message on failure
558
+ bool result = SDL_SetJoystickLED(joy, colors[0], colors[1], colors[2]);
559
+ if (!result) {
560
+ printf("%s\n", SDL_GetError());
561
+ }
562
+ return PyBool_FromLong(result);
563
+#endif
564
565
566
static PyMethodDef joy_methods[] = {
0 commit comments