From 8462c552d12f0700b3ed0529d16bfc7653dfa6cc Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 28 Jun 2017 21:30:27 +0200 Subject: [PATCH] Add a warning for very low screen resolutions. There are some android devices that are 320x240, 400x240 etc... Bare minimum to run STK is 640x480. Otherwise some important gui elements are not displayed and it may crash in guiengine. --- src/main.cpp | 74 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4d0c46bd4..d80d1be3f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1640,37 +1640,57 @@ int main(int argc, char *argv[] ) exit(0); } - if (!ProfileWorld::isNoGraphics() && - GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_DRIVER_RECENT_ENOUGH)) - { - if (UserConfigParams::m_old_driver_popup) - { - MessageDialog *dialog = - new MessageDialog(_("Your driver version is too old. Please install " - "the latest video drivers."), - /*from queue*/ true); - GUIEngine::DialogQueue::get()->pushDialog(dialog); - } - Log::warn("OpenGL", "Driver is too old!"); - } #ifndef SERVER_ONLY - else if (!CVS->isGLSL()) + if (!ProfileWorld::isNoGraphics()) { - if (UserConfigParams::m_old_driver_popup) + // Some Android devices have only 320x240 and height >= 480 is bare + // minimum to make the GUI working as expected. + if (irr_driver->getActualScreenSize().Height < 480) { - #ifdef USE_GLES2 - irr::core::stringw version = "OpenGL ES 3.0"; - #else - irr::core::stringw version = "OpenGL 3.1"; - #endif - MessageDialog *dialog = - new MessageDialog(_("Your OpenGL version appears to be too old. Please verify " - "if an update for your video driver is available. SuperTuxKart requires %s or better.", - version), - /*from queue*/ true); - GUIEngine::DialogQueue::get()->pushDialog(dialog); + if (UserConfigParams::m_old_driver_popup) + { + MessageDialog *dialog = + new MessageDialog(_("Your screen resolution is too " + "small to run STK."), + /*from queue*/ true); + GUIEngine::DialogQueue::get()->pushDialog(dialog); + } + Log::warn("main", "Screen size is too small!"); + } + + if (GraphicsRestrictions::isDisabled( + GraphicsRestrictions::GR_DRIVER_RECENT_ENOUGH)) + { + if (UserConfigParams::m_old_driver_popup) + { + MessageDialog *dialog = + new MessageDialog(_("Your driver version is too old. " + "Please install the latest video " + "drivers."), /*from queue*/ true); + GUIEngine::DialogQueue::get()->pushDialog(dialog); + } + Log::warn("OpenGL", "Driver is too old!"); + } + else if (!CVS->isGLSL()) + { + if (UserConfigParams::m_old_driver_popup) + { + #ifdef USE_GLES2 + irr::core::stringw version = "OpenGL ES 3.0"; + #else + irr::core::stringw version = "OpenGL 3.1"; + #endif + MessageDialog *dialog = + new MessageDialog(_("Your OpenGL version appears to be " + "too old. Please verify if an " + "update for your video driver is " + "available. SuperTuxKart requires " + "%s or better.", version), + /*from queue*/ true); + GUIEngine::DialogQueue::get()->pushDialog(dialog); + } + Log::warn("OpenGL", "OpenGL version is too old!"); } - Log::warn("OpenGL", "OpenGL version is too old!"); } #endif // Note that on the very first run of STK internet status is set to