|
@@ -244,7 +244,7 @@ static const int CursorsLUT[] = {
|
|
// SDL3 Migration:
|
|
// SDL3 Migration:
|
|
// SDL_WINDOW_FULLSCREEN_DESKTOP has been removed,
|
|
// SDL_WINDOW_FULLSCREEN_DESKTOP has been removed,
|
|
// and you can call SDL_GetWindowFullscreenMode()
|
|
// and you can call SDL_GetWindowFullscreenMode()
|
|
-// to see whether an exclusive fullscreen mode will be used
|
|
|
|
|
|
+// to see whether an exclusive fullscreen mode will be used
|
|
// or the borderless fullscreen desktop mode will be used
|
|
// or the borderless fullscreen desktop mode will be used
|
|
#define SDL_WINDOW_FULLSCREEN_DESKTOP SDL_WINDOW_FULLSCREEN
|
|
#define SDL_WINDOW_FULLSCREEN_DESKTOP SDL_WINDOW_FULLSCREEN
|
|
|
|
|
|
@@ -269,7 +269,7 @@ const char *SDL_GameControllerNameForIndex(int joystickIndex)
|
|
const char *name = NULL;
|
|
const char *name = NULL;
|
|
int numJoysticks = 0;
|
|
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)
|
|
@@ -277,10 +277,10 @@ const char *SDL_GameControllerNameForIndex(int joystickIndex)
|
|
SDL_JoystickID instance_id = joysticks[joystickIndex];
|
|
SDL_JoystickID instance_id = joysticks[joystickIndex];
|
|
name = SDL_GetGamepadNameForID(instance_id);
|
|
name = SDL_GetGamepadNameForID(instance_id);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
SDL_free(joysticks);
|
|
SDL_free(joysticks);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -288,7 +288,7 @@ int SDL_GetNumVideoDisplays(void)
|
|
{
|
|
{
|
|
int monitorCount = 0;
|
|
int monitorCount = 0;
|
|
SDL_DisplayID *displays = SDL_GetDisplays(&monitorCount);
|
|
SDL_DisplayID *displays = SDL_GetDisplays(&monitorCount);
|
|
-
|
|
|
|
|
|
+
|
|
// Safe because If `mem` is NULL, SDL_free does nothing
|
|
// Safe because If `mem` is NULL, SDL_free does nothing
|
|
SDL_free(displays);
|
|
SDL_free(displays);
|
|
|
|
|
|
@@ -300,21 +300,21 @@ int SDL_GetNumVideoDisplays(void)
|
|
Uint8 SDL_EventState(Uint32 type, int state)
|
|
Uint8 SDL_EventState(Uint32 type, int state)
|
|
{
|
|
{
|
|
Uint8 stateBefore = SDL_EventEnabled(type);
|
|
Uint8 stateBefore = SDL_EventEnabled(type);
|
|
-
|
|
|
|
|
|
+
|
|
switch (state)
|
|
switch (state)
|
|
{
|
|
{
|
|
case SDL_DISABLE: SDL_SetEventEnabled(type, false); break;
|
|
case SDL_DISABLE: SDL_SetEventEnabled(type, false); break;
|
|
case SDL_ENABLE: SDL_SetEventEnabled(type, true); break;
|
|
case SDL_ENABLE: SDL_SetEventEnabled(type, true); break;
|
|
default: TRACELOG(LOG_WARNING, "Event sate: unknow type");
|
|
default: TRACELOG(LOG_WARNING, "Event sate: unknow type");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return stateBefore;
|
|
return stateBefore;
|
|
}
|
|
}
|
|
|
|
|
|
void SDL_GetCurrentDisplayMode_Adapter(SDL_DisplayID displayID, SDL_DisplayMode* mode)
|
|
void SDL_GetCurrentDisplayMode_Adapter(SDL_DisplayID displayID, SDL_DisplayMode* mode)
|
|
{
|
|
{
|
|
const SDL_DisplayMode* currMode = SDL_GetCurrentDisplayMode(displayID);
|
|
const SDL_DisplayMode* currMode = SDL_GetCurrentDisplayMode(displayID);
|
|
-
|
|
|
|
|
|
+
|
|
if (currMode == NULL) TRACELOG(LOG_WARNING, "No current display mode");
|
|
if (currMode == NULL) TRACELOG(LOG_WARNING, "No current display mode");
|
|
else *mode = *currMode;
|
|
else *mode = *currMode;
|
|
}
|
|
}
|
|
@@ -335,11 +335,11 @@ SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth
|
|
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
|
|
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
|
|
{
|
|
{
|
|
float dpi = SDL_GetWindowDisplayScale(platform.window)*96.0;
|
|
float dpi = SDL_GetWindowDisplayScale(platform.window)*96.0;
|
|
-
|
|
|
|
|
|
+
|
|
if (ddpi != NULL) *ddpi = dpi;
|
|
if (ddpi != NULL) *ddpi = dpi;
|
|
if (hdpi != NULL) *hdpi = dpi;
|
|
if (hdpi != NULL) *hdpi = dpi;
|
|
if (vdpi != NULL) *vdpi = dpi;
|
|
if (vdpi != NULL) *vdpi = dpi;
|
|
-
|
|
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -408,7 +408,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID)
|
|
void* SDL_GetClipboardData(const char *mime_type, size_t *size)
|
|
void* SDL_GetClipboardData(const char *mime_type, size_t *size)
|
|
{
|
|
{
|
|
TRACELOG(LOG_WARNING, "Getting clipboard data that is not text is only available in SDL3");
|
|
TRACELOG(LOG_WARNING, "Getting clipboard data that is not text is only available in SDL3");
|
|
-
|
|
|
|
|
|
+
|
|
// We could possibly implement it ourselves in this case for some easier platforms
|
|
// We could possibly implement it ourselves in this case for some easier platforms
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -930,7 +930,7 @@ Vector2 GetMonitorPosition(int monitor)
|
|
if ((monitor >= 0) && (monitor < monitorCount))
|
|
if ((monitor >= 0) && (monitor < monitorCount))
|
|
{
|
|
{
|
|
SDL_Rect displayBounds;
|
|
SDL_Rect displayBounds;
|
|
-
|
|
|
|
|
|
+
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
if (SDL_GetDisplayUsableBounds(monitor, &displayBounds))
|
|
if (SDL_GetDisplayUsableBounds(monitor, &displayBounds))
|
|
#else
|
|
#else
|
|
@@ -1124,12 +1124,12 @@ Image GetClipboardImage(void)
|
|
|
|
|
|
size_t dataSize = 0;
|
|
size_t dataSize = 0;
|
|
void *fileData = NULL;
|
|
void *fileData = NULL;
|
|
-
|
|
|
|
|
|
+
|
|
for (int i = 0; i < SDL_arraysize(imageFormats); ++i)
|
|
for (int i = 0; i < SDL_arraysize(imageFormats); ++i)
|
|
{
|
|
{
|
|
// NOTE: This pointer should be free with SDL_free() at some point
|
|
// NOTE: This pointer should be free with SDL_free() at some point
|
|
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
|
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
|
-
|
|
|
|
|
|
+
|
|
if (fileData)
|
|
if (fileData)
|
|
{
|
|
{
|
|
image = LoadImageFromMemory(imageExtensions[i], fileData, dataSize);
|
|
image = LoadImageFromMemory(imageExtensions[i], fileData, dataSize);
|
|
@@ -1288,9 +1288,9 @@ static void UpdateTouchPointsSDL(SDL_TouchFingerEvent event)
|
|
CORE.Input.Touch.position[i].y = finger->y*CORE.Window.screen.height;
|
|
CORE.Input.Touch.position[i].y = finger->y*CORE.Window.screen.height;
|
|
CORE.Input.Touch.currentTouchState[i] = 1;
|
|
CORE.Input.Touch.currentTouchState[i] = 1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
SDL_free(fingers);
|
|
SDL_free(fingers);
|
|
-
|
|
|
|
|
|
+
|
|
#else // SDL2
|
|
#else // SDL2
|
|
|
|
|
|
CORE.Input.Touch.pointCount = SDL_GetNumTouchFingers(event.touchId);
|
|
CORE.Input.Touch.pointCount = SDL_GetNumTouchFingers(event.touchId);
|
|
@@ -1395,7 +1395,7 @@ void PollInputEvents(void)
|
|
CORE.Window.dropFilepaths = (char **)RL_CALLOC(1024, sizeof(char *));
|
|
CORE.Window.dropFilepaths = (char **)RL_CALLOC(1024, sizeof(char *));
|
|
|
|
|
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
-
|
|
|
|
|
|
+
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
// const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
|
|
// const char *data; /**< The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events */
|
|
// Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE, and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events, you should make a copy of it. SDL_TEXTINPUTEVENT_TEXT_SIZE is no longer necessary and has been removed.
|
|
// Event memory is now managed by SDL, so you should not free the data in SDL_EVENT_DROP_FILE, and if you want to hold onto the text in SDL_EVENT_TEXT_EDITING and SDL_EVENT_TEXT_INPUT events, you should make a copy of it. SDL_TEXTINPUTEVENT_TEXT_SIZE is no longer necessary and has been removed.
|
|
@@ -1410,7 +1410,7 @@ void PollInputEvents(void)
|
|
else if (CORE.Window.dropFileCount < 1024)
|
|
else if (CORE.Window.dropFileCount < 1024)
|
|
{
|
|
{
|
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
CORE.Window.dropFilepaths[CORE.Window.dropFileCount] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char));
|
|
-
|
|
|
|
|
|
+
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
|
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.data);
|
|
strcpy(CORE.Window.dropFilepaths[CORE.Window.dropFileCount], event.drop.data);
|
|
#else
|
|
#else
|