Bump minimum SDL version to 2.0.9

This commit is contained in:
Miku AuahDark
2022-12-06 14:14:30 +08:00
parent 72fca1c2da
commit 93612a84d1
5 changed files with 2 additions and 20 deletions
-2
View File
@@ -374,7 +374,6 @@ Message *Event::convert(const SDL_Event &e)
case SDL_WINDOWEVENT:
msg = convertWindowEvent(e);
break;
#if SDL_VERSION_ATLEAST(2, 0, 9)
case SDL_DISPLAYEVENT:
if (e.display.event == SDL_DISPLAYEVENT_ORIENTATION)
{
@@ -408,7 +407,6 @@ Message *Event::convert(const SDL_Event &e)
msg = new Message("displayrotated", vargs);
}
break;
#endif
case SDL_DROPFILE:
filesystem = Module::getInstance<filesystem::Filesystem>(Module::M_FILESYSTEM);
if (filesystem != nullptr)
-6
View File
@@ -413,7 +413,6 @@ int Joystick::getID() const
void Joystick::getDeviceInfo(int &vendorID, int &productID, int &productVersion) const
{
#if SDL_VERSION_ATLEAST(2, 0, 6)
if (joyhandle != nullptr)
{
vendorID = SDL_JoystickGetVendor(joyhandle);
@@ -421,7 +420,6 @@ void Joystick::getDeviceInfo(int &vendorID, int &productID, int &productVersion)
productVersion = SDL_JoystickGetProductVersion(joyhandle);
}
else
#endif
{
vendorID = 0;
productID = 0;
@@ -525,10 +523,8 @@ bool Joystick::setVibration(float left, float right, float duration)
bool success = false;
#if SDL_VERSION_ATLEAST(2, 0, 9)
if (SDL_JoystickRumble(joyhandle, (Uint16)(left * LOVE_UINT16_MAX), (Uint16)(right * LOVE_UINT16_MAX), length) == 0)
success = true;
#endif
if (!success && !checkCreateHaptic())
return false;
@@ -610,10 +606,8 @@ bool Joystick::setVibration()
{
bool success = false;
#if SDL_VERSION_ATLEAST(2, 0, 9)
if (!success)
success = isConnected() && SDL_JoystickRumble(joyhandle, 0, 0, 0) == 0;
#endif
if (!success && SDL_WasInit(SDL_INIT_HAPTIC) && haptic && SDL_HapticIndex(haptic) != -1)
success = (SDL_HapticStopEffect(haptic, vibration.id) == 0);
-10
View File
@@ -588,12 +588,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
if (!f.fullscreen)
SDL_SetWindowSize(window, width, height);
// On linux systems 2.0.5+ might not be available...
// TODO: require at least 2.0.5?
#if SDL_VERSION_ATLEAST(2, 0, 5)
if (this->settings.resizable != f.resizable)
SDL_SetWindowResizable(window, f.resizable ? SDL_TRUE : SDL_FALSE);
#endif
if (this->settings.borderless != f.borderless)
SDL_SetWindowBordered(window, f.borderless ? SDL_FALSE : SDL_TRUE);
@@ -909,9 +905,6 @@ const char *Window::getDisplayName(int displayindex) const
Window::DisplayOrientation Window::getDisplayOrientation(int displayindex) const
{
// TODO: We can expose this everywhere, we just need to watch out for the
// SDL binary being older than the headers on Linux.
#if SDL_VERSION_ATLEAST(2, 0, 9) && (defined(LOVE_ANDROID) || !defined(LOVE_LINUX))
switch (SDL_GetDisplayOrientation(displayindex))
{
case SDL_ORIENTATION_UNKNOWN: return ORIENTATION_UNKNOWN;
@@ -920,9 +913,6 @@ Window::DisplayOrientation Window::getDisplayOrientation(int displayindex) const
case SDL_ORIENTATION_PORTRAIT: return ORIENTATION_PORTRAIT;
case SDL_ORIENTATION_PORTRAIT_FLIPPED: return ORIENTATION_PORTRAIT_FLIPPED;
}
#else
LOVE_UNUSED(displayindex);
#endif
return ORIENTATION_UNKNOWN;
}