Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
Showing
5 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -599,7 +599,8 @@ void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr, | |
Additionally, a progressbar can be drawn when percent is set between 0 and 100. | ||
*/ | ||
void draw_load_screen(const std::wstring &text, IrrlichtDevice* device, | ||
gui::IGUIEnvironment* guienv, float dtime, int percent, bool clouds ) | ||
gui::IGUIEnvironment* guienv, ITextureSource *tsrc, | ||
float dtime, int percent, bool clouds) | ||
{ | ||
video::IVideoDriver* driver = device->getVideoDriver(); | ||
v2u32 screensize = porting::getWindowSize(); | ||
|
@@ -625,27 +626,20 @@ void draw_load_screen(const std::wstring &text, IrrlichtDevice* device, | |
|
||
// draw progress bar | ||
if ((percent >= 0) && (percent <= 100)) { | ||
const std::string &texture_path = g_settings->get("texture_path"); | ||
std::string tp_progress_bar = texture_path + "/progress_bar.png"; | ||
std::string tp_progress_bar_bg = texture_path + "/progress_bar_bg.png"; | ||
|
||
if (!(fs::PathExists(tp_progress_bar) && | ||
fs::PathExists(tp_progress_bar_bg))) { | ||
std::string gamepath = fs::RemoveRelativePathComponents( | ||
porting::path_share + DIR_DELIM + "textures"); | ||
tp_progress_bar = gamepath + "/base/pack/progress_bar.png"; | ||
tp_progress_bar_bg = gamepath + "/base/pack/progress_bar_bg.png"; | ||
} | ||
|
||
video::ITexture *progress_img = | ||
driver->getTexture(tp_progress_bar.c_str()); | ||
video::ITexture *progress_img_bg = | ||
driver->getTexture(tp_progress_bar_bg.c_str()); | ||
video::ITexture *progress_img = tsrc->getTexture("progress_bar.png"); | ||
video::ITexture *progress_img_bg = tsrc->getTexture("progress_bar_bg.png"); | ||
|
||
if (progress_img && progress_img_bg) { | ||
#ifndef __ANDROID__ | ||
const core::dimension2d<u32> &img_size = progress_img_bg->getSize(); | ||
u32 imgW = rangelim(img_size.Width, 200, 600); | ||
u32 imgH = rangelim(img_size.Height, 24, 72); | ||
#else | ||
const core::dimension2d<u32> img_size(256, 48); | ||
This comment has been minimized.
Sorry, something went wrong.
sfan5
Member
|
||
float imgRatio = (float) img_size.Height / img_size.Width; | ||
u32 imgW = screensize.X / 2.2f; | ||
u32 imgH = floor(imgW * imgRatio); | ||
#endif | ||
v2s32 img_pos((screensize.X - imgW) / 2, (screensize.Y - imgH) / 2); | ||
|
||
draw2DImageFilterScaled( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unused variable