Преглед изворни кода

[rcore] fix warnings in SDL3 compatibility layer

pull/4459/head
evertonse пре 1 година
родитељ
комит
505d5fcf1b
2 измењених фајлова са 13 додато и 13 уклоњено
  1. +13
    -12
      src/platforms/rcore_desktop_sdl.c
  2. +0
    -1
      src/raylib.h

+ 13
- 12
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 // NOTE: SDL3 uses the IDs itself (SDL_JoystickID) instead of SDL2 joystick_index
const char* name = NULL; const char* name = NULL;
int i, numJoysticks;
int numJoysticks = 0;
SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks); SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks);
if (joysticks) { if (joysticks) {
if (joystickIndex < numJoysticks) { if (joystickIndex < numJoysticks) {
@ -294,19 +294,20 @@ int SDL_GetNumVideoDisplays(void)
return monitorCount; 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 SDL_EventState(Uint32 type, int state) {
Uint8 stateBefore = SDL_EventEnabled(type);
switch (state) 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) 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 // not reliable across platforms, approximately replaced by multiplying
// SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms. // SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms.
int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) {
SDL_GetWindowDisplayScale(platform.window) * 96;
k">return SDL_GetWindowDisplayScale(platform.window) * 96;
} }
SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) 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 SDL_NumJoysticks(void)
{ {
int i, numJoysticks;
int numJoysticks;
SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks); SDL_JoystickID *joysticks = SDL_GetJoysticks(&numJoysticks);
SDL_free(joysticks); SDL_free(joysticks);
return numJoysticks; return numJoysticks;

+ 0
- 1
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 void SetClipboardText(const char *text); // Set clipboard text content
RLAPI const char *GetClipboardText(void); // Get clipboard text content RLAPI const char *GetClipboardText(void); // Get clipboard text content
RLAPI Image GetClipboardImage(void); // Get clipboard image 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 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 RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling

Loading…
Откажи
Сачувај