diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp index 3366024cc..4cddb1ee8 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp @@ -1108,12 +1108,12 @@ bool CIrrDeviceSDL::hasOnScreenKeyboard() const } -bool CIrrDeviceSDL::hasHardwareKeyboard() const +u32 CIrrDeviceSDL::getOnScreenKeyboardHeight() const { #ifdef MOBILE_STK - return SDL_HasHardwareKeyboardConnected() == SDL_TRUE; + return SDL_GetScreenKeyboardHeight() * NativeScale; #else - return true; + return 0; #endif } diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h index 3e447f949..6a556ce10 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h @@ -137,8 +137,7 @@ namespace irr virtual bool hasOnScreenKeyboard() const; - virtual bool hasHardwareKeyboard() const; - + virtual u32 getOnScreenKeyboardHeight() const; virtual bool activateAccelerometer(float updateInterval); virtual bool deactivateAccelerometer(); diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 71e5e5c45..3da68919f 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -780,6 +780,7 @@ void IrrDriver::initDevice() m_device->registerGetMovedHeightFunction([] (const IrrlichtDevice* device)->int { +#ifdef ANDROID int screen_keyboard_height = device->getOnScreenKeyboardHeight(); int screen_height = device->getScreenHeight(); @@ -803,6 +804,9 @@ void IrrDriver::initDevice() return screen_keyboard_height; } return screen_keyboard_height - element_height; +#else + return 0; +#endif }); } // initDevice diff --git a/src/guiengine/message_queue.cpp b/src/guiengine/message_queue.cpp index 20e0bacc4..17cd8e568 100644 --- a/src/guiengine/message_queue.cpp +++ b/src/guiengine/message_queue.cpp @@ -27,6 +27,11 @@ #include #include +// Can be removed later when android STK uses SDL2 +#ifdef IOS_STK +#include "SDL_keyboard.h" +#endif + using namespace GUIEngine; namespace MessageQueue @@ -212,9 +217,16 @@ public: int pos_transform = 0; if (m_container == g_container.get()) pos_transform = s_msg_raise; + int moved_height = 0; +#ifdef ANDROID + moved_height = irr_driver->getDevice()->getMovedHeight(); +#elif defined(IOS_STK) + moved_height = SDL_GetMovedHeightByScreenKeyboard() * + irr_driver->getDevice()->getNativeScale(); +#endif core::position2di raise = core::position2di(0, irr_driver->getDevice()->getOnScreenKeyboardHeight() - - irr_driver->getDevice()->getMovedHeight() + pos_transform); + moved_height + pos_transform); GUIEngine::getSkin()->drawMessage(m_container, m_area - raise, m_render_type); GUIEngine::getFont()->draw(m_gls, m_text_rect - raise, @@ -317,9 +329,16 @@ public: { Message::draw(dt); m_display_timer = 9999999.9f; + int moved_height = 0; +#ifdef ANDROID + moved_height = irr_driver->getDevice()->getMovedHeight(); +#elif defined(IOS_STK) + moved_height = SDL_GetMovedHeightByScreenKeyboard() * + irr_driver->getDevice()->getNativeScale(); +#endif core::position2di raise = core::position2di(0, irr_driver->getDevice()->getOnScreenKeyboardHeight() - - irr_driver->getDevice()->getMovedHeight()); + moved_height); GUIEngine::getSkin()->drawProgressBarInScreen(&m_swc, m_area - raise, (float)g_progress.load() / 100.0f); video::SColor color(255, 0, 0, 0);