Merge remote-tracking branch 'origin/master' into voting_gui

This commit is contained in:
Benau 2018-12-22 10:35:09 +08:00
commit 86198881f4
3 changed files with 24 additions and 5 deletions

View File

@ -19,6 +19,7 @@
#include "states_screens/ghost_replay_selection.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "graphics/material.hpp"
#include "guiengine/CGUISpriteBank.hpp"
#include "karts/kart_properties.hpp"
@ -172,11 +173,16 @@ void GhostReplaySelection::init()
Screen::init();
m_cur_difficulty = race_manager->getDifficulty();
int icon_height = getHeight()/24;
int icon_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 15
: getHeight() / 24;
int row_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 12
: getHeight() / 24;
// 128 is the height of the image file
m_icon_bank->setScale(icon_height/128.0f);
m_icon_bank->setTargetIconSize(128, 128);
m_replay_list_widget->setIcons(m_icon_bank, (int)icon_height);
m_replay_list_widget->setIcons(m_icon_bank, (int)row_height);
refresh(/*reload replay files*/ false, /* update columns */ true);
} // init

View File

@ -129,8 +129,17 @@ void NetworkingLobby::loadedFromFile()
m_icon_bank->addTextureAsSprite(icon_3);
m_icon_bank->addTextureAsSprite(icon_4);
m_icon_bank->addTextureAsSprite(icon_5);
const int screen_width = irr_driver->getFrameSize().Width;
m_icon_bank->setScale(screen_width > 1280 ? 0.4f : 0.25f);
if (UserConfigParams::m_hidpi_enabled)
{
m_icon_bank->setScale(getHeight() / 15.0f / 128.0f);
}
else
{
const int screen_width = irr_driver->getFrameSize().Width;
m_icon_bank->setScale(screen_width > 1280 ? 0.4f : 0.25f);
}
} // loadedFromFile
// ---------------------------------------------------------------------------

View File

@ -140,7 +140,11 @@ void ServerSelection::init()
m_searcher->clearListeners();
m_searcher->addListener(this);
m_icon_bank->setScale((float)getHeight() / 15.0f / 128.0f);
m_server_list_widget->setIcons(m_icon_bank, int(getHeight() / 15.0f));
int row_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 12.0f
: getHeight() / 15.0f;
m_server_list_widget->setIcons(m_icon_bank, row_height);
m_sort_desc = false;
/** Triggers the loading of the server list in the servers manager. */
refresh(true);