Fix unused variable warnings (SDL)
This commit is contained in:
parent
71643d8cda
commit
9cd6d36a41
1 changed files with 14 additions and 35 deletions
|
|
@ -469,12 +469,11 @@ bool WindowShouldClose(void)
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
|
||||||
|
|
@ -495,12 +494,11 @@ void ToggleFullscreen(void)
|
||||||
void ToggleBorderlessWindowed(void)
|
void ToggleBorderlessWindowed(void)
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
if (FLAG_IS_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
|
|
@ -552,12 +550,11 @@ void SetWindowState(unsigned int flags)
|
||||||
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
if (FLAG_IS_SET(flags, FLAG_FULLSCREEN_MODE))
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN);
|
||||||
|
|
@ -614,12 +611,11 @@ void SetWindowState(unsigned int flags)
|
||||||
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
if (FLAG_IS_SET(flags, FLAG_BORDERLESS_WINDOWED_MODE))
|
||||||
{
|
{
|
||||||
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
const int monitor = SDL_GetWindowDisplayIndex(platform.window);
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(platform.window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
|
@ -836,11 +832,10 @@ void SetWindowPosition(int x, int y)
|
||||||
// Set monitor for the current window
|
// Set monitor for the current window
|
||||||
void SetWindowMonitor(int monitor)
|
void SetWindowMonitor(int monitor)
|
||||||
{
|
{
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// NOTE 1: SDL started supporting moving exclusive fullscreen windows between displays on SDL3,
|
// NOTE 1: SDL started supporting moving exclusive fullscreen windows between displays on SDL3,
|
||||||
|
|
@ -997,32 +992,23 @@ void *GetWindowHandle(void)
|
||||||
// Get number of monitors
|
// Get number of monitors
|
||||||
int GetMonitorCount(void)
|
int GetMonitorCount(void)
|
||||||
{
|
{
|
||||||
int monitorCount = 0;
|
return SDL_GetNumVideoDisplays();
|
||||||
|
|
||||||
monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
return monitorCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current monitor where window is placed
|
// Get current monitor where window is placed
|
||||||
int GetCurrentMonitor(void)
|
int GetCurrentMonitor(void)
|
||||||
{
|
{
|
||||||
int currentMonitor = 0;
|
|
||||||
|
|
||||||
// Be aware that this returns an ID in SDL3 and a Index in SDL2
|
// Be aware that this returns an ID in SDL3 and a Index in SDL2
|
||||||
currentMonitor = SDL_GetWindowDisplayIndex(platform.window);
|
return SDL_GetWindowDisplayIndex(platform.window);
|
||||||
|
|
||||||
return currentMonitor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor position
|
// Get selected monitor position
|
||||||
Vector2 GetMonitorPosition(int monitor)
|
Vector2 GetMonitorPosition(int monitor)
|
||||||
{
|
{
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_Rect displayBounds;
|
SDL_Rect displayBounds;
|
||||||
|
|
@ -1046,11 +1032,10 @@ int GetMonitorWidth(int monitor)
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
@ -1067,11 +1052,10 @@ int GetMonitorHeight(int monitor)
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
@ -1088,11 +1072,10 @@ int GetMonitorPhysicalWidth(int monitor)
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float ddpi = 0.0f;
|
float ddpi = 0.0f;
|
||||||
|
|
@ -1112,11 +1095,10 @@ int GetMonitorPhysicalHeight(int monitor)
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float ddpi = 0.0f;
|
float ddpi = 0.0f;
|
||||||
|
|
@ -1136,11 +1118,10 @@ int GetMonitorRefreshRate(int monitor)
|
||||||
{
|
{
|
||||||
int refresh = 0;
|
int refresh = 0;
|
||||||
|
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
@ -1155,12 +1136,10 @@ int GetMonitorRefreshRate(int monitor)
|
||||||
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
||||||
const char *GetMonitorName(int monitor)
|
const char *GetMonitorName(int monitor)
|
||||||
{
|
{
|
||||||
const int monitorCount = SDL_GetNumVideoDisplays();
|
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
|
||||||
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
|
||||||
#else
|
#else
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
if ((monitor >= 0) && (monitor < SDL_GetNumVideoDisplays()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return SDL_GetDisplayName(monitor);
|
return SDL_GetDisplayName(monitor);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue