diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 33e78b0ef..5e1a4f0fc 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -272,7 +272,7 @@ const char* SDL_GameControllerNameForIndex(int joystickIndex) { // NOTE: SDL3 uses the IDs itself (SDL_JoystickID) instead of SDL2 joystick_index const char* name = NULL; - int i, numJoysticks; + int numJoysticks = 0; SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks); if (joysticks) { if (joystickIndex < numJoysticks) { @@ -294,19 +294,20 @@ int SDL_GetNumVideoDisplays(void) return monitorCount; } + +// SLD3 Migration: +// To emulate SDL2 this function should return `SDL_DISABLE` or `SDL_ENABLE` +// representing the *processing state* of the event before this function makes any changes to it. Uint8 SDL_EventState(Uint32 type, int state) { + + Uint8 stateBefore = SDL_EventEnabled(type); switch (state) { - case SDL_DISABLE: - SDL_SetEventEnabled(type, false); - break; - case SDL_ENABLE: - SDL_SetEventEnabled(type, true); - break; - default: - TRACELOG(LOG_WARNING, "Event sate: unknow type"); - break; + case SDL_DISABLE: SDL_SetEventEnabled(type, false); break; + case SDL_ENABLE: SDL_SetEventEnabled(type, true); break; + default: TRACELOG(LOG_WARNING, "Event sate: unknow type"); } + return stateBefore; } void SDL_GetCurrentDisplayMode_Adapter(SDL_DisplayID displayID, SDL_DisplayMode* mode) @@ -336,7 +337,7 @@ SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth // not reliable across platforms, approximately replaced by multiplying // SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms. int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { - SDL_GetWindowDisplayScale(platform.window) * 96; + return SDL_GetWindowDisplayScale(platform.window) * 96; } SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) @@ -356,7 +357,7 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int hei int SDL_NumJoysticks(void) { - int i, numJoysticks; + int numJoysticks; SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks); SDL_free(joysticks); return numJoysticks; diff --git a/src/raylib.h b/src/raylib.h index 723f787d9..89d1fdfde 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1012,7 +1012,6 @@ RLAPI const char *GetMonitorName(int monitor); // Get the hum RLAPI void SetClipboardText(const char *text); // Set clipboard text content RLAPI const char *GetClipboardText(void); // Get clipboard text content RLAPI Image GetClipboardImage(void); // Get clipboard image -void SetClipboardImage(Image *image) RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling