From 73de17afa821ccea84a119096b267e05a77db3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 16 Apr 2017 14:44:15 +0200 Subject: Android progressbar fix (#5601) * Fix progressbar for Android Fixes #5599 Fixed #5403 * draw_load_screen: use texturesource this permits to unify texture loading code * scale progress bar * Add gl version check for GL_OES_texture_npot. This fixed the texture on loading screen * Remove two sanity checks pointed by @celeron55 * sfan5 comments + android ratio fixes --- src/client.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 246525f62..5ca51bd9c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1782,6 +1782,7 @@ typedef struct TextureUpdateArgs { u32 last_time_ms; u16 last_percent; const wchar_t* text_base; + ITextureSource *tsrc; } TextureUpdateArgs; void texture_update_progress(void *args, u32 progress, u32 max_progress) @@ -1803,8 +1804,8 @@ void texture_update_progress(void *args, u32 progress, u32 max_progress) targs->last_time_ms = time_ms; std::basic_stringstream strm; strm << targs->text_base << " " << targs->last_percent << "%..."; - draw_load_screen(strm.str(), targs->device, targs->guienv, 0, - 72 + (u16) ((18. / 100.) * (double) targs->last_percent)); + draw_load_screen(strm.str(), targs->device, targs->guienv, targs->tsrc, 0, + 72 + (u16) ((18. / 100.) * (double) targs->last_percent), true); } } @@ -1824,21 +1825,21 @@ void Client::afterContentReceived(IrrlichtDevice *device) // Rebuild inherited images and recreate textures infostream<<"- Rebuilding images and textures"<rebuildImagesAndTextures(); delete[] text; // Rebuild shaders infostream<<"- Rebuilding shaders"<rebuildShaders(); delete[] text; // Update node aliases infostream<<"- Updating node aliases"<updateAliases(m_itemdef); std::string texture_path = g_settings->get("texture_path"); if (texture_path != "" && fs::IsDir(texture_path)) @@ -1855,6 +1856,7 @@ void Client::afterContentReceived(IrrlichtDevice *device) tu_args.last_time_ms = getTimeMs(); tu_args.last_percent = 0; tu_args.text_base = wgettext("Initializing nodes"); + tu_args.tsrc = m_tsrc; m_nodedef->updateTextures(this, texture_update_progress, &tu_args); delete[] tu_args.text_base; @@ -1871,7 +1873,7 @@ void Client::afterContentReceived(IrrlichtDevice *device) } text = wgettext("Done!"); - draw_load_screen(text, device, guienv, 0, 100); + draw_load_screen(text, device, guienv, m_tsrc, 0, 100); infostream<<"Client::afterContentReceived() done"<