A better solution for those scaling issues in high or creepy resolutions gen II (#3910)
* Fix scaling issues * Fonts size adjustion support * Add fonts size support && Fix scaling issue * Use fonts height * Fix scaling issues * Add my name onto CREDITS * Fix scaling issues * Fix scaling issues * Use space instead of tab * Use space instead of tab * Fix bad scale * Use font height
This commit is contained in:
parent
86bc8bd877
commit
da4ac0a976
@ -93,6 +93,7 @@ Bug fixes & misc contributions
|
|||||||
- Ward Muylaert
|
- Ward Muylaert
|
||||||
- Fantasmos
|
- Fantasmos
|
||||||
- QwertyChouskie
|
- QwertyChouskie
|
||||||
|
- Dumaosen
|
||||||
|
|
||||||
= Visual art =
|
= Visual art =
|
||||||
|
|
||||||
|
@ -7,16 +7,16 @@
|
|||||||
<icon-button id="reload" height="90%" icon="gui/icons/restart.png"/>
|
<icon-button id="reload" height="90%" icon="gui/icons/restart.png"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<box id="filter_box" width="97%" height="75" layout="vertical-row" align="center">
|
<box id="filter_box" width="97%" height="2f" layout="vertical-row" align="center">
|
||||||
<div x="0" y="0" width="98%" height="100%" layout="horizontal-row" align="center">
|
<div x="0" y="0" width="98%" height="100%" layout="horizontal-row" align="center">
|
||||||
<textbox id="filter_name" proportion="7" align="center" />
|
<textbox id="filter_name" proportion="7" align="center" />
|
||||||
<spacer width="20" />
|
<spacer width="1f" />
|
||||||
<label text="Updated" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only recently updated items"/>
|
<label text="Updated" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only recently updated items"/>
|
||||||
<spacer width="10" />
|
<spacer width="1f" />
|
||||||
<spinner id="filter_date" proportion="8" align="center" min_value="0" wrap_around="true"/>
|
<spinner id="filter_date" proportion="8" align="center" min_value="0" wrap_around="true"/>
|
||||||
<spacer width="10" />
|
<spacer width="1f" />
|
||||||
<label text="Rating >=" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only items with good rating"/>
|
<label text="Rating >=" align="center" I18N="In addons screen, in the filtering bar, to enable a filter that will show only items with good rating"/>
|
||||||
<spacer width="10" />
|
<spacer width="1f" />
|
||||||
<spinner id="filter_rating" proportion="5" align="center" min_value="0" wrap_around="true"/>
|
<spinner id="filter_rating" proportion="5" align="center" min_value="0" wrap_around="true"/>
|
||||||
<icon-button id="filter_search" height="100%" icon="gui/icons/search.png"/>
|
<icon-button id="filter_search" height="100%" icon="gui/icons/search.png"/>
|
||||||
</div>
|
</div>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<spacer height="15" width="10"/>
|
<spacer height="15" width="10"/>
|
||||||
|
|
||||||
<tabs id="category" height="10%" max_height="110" width="90%" align="center">
|
<tabs id="category" height="2f" width="90%" align="center">
|
||||||
<icon-button id="tab_kart" width="128" height="128" icon="gui/icons/karts.png"
|
<icon-button id="tab_kart" width="128" height="128" icon="gui/icons/karts.png"
|
||||||
I18N="In the addons screen" text="Karts"/>
|
I18N="In the addons screen" text="Karts"/>
|
||||||
<icon-button id="tab_track" width="128" height="128" icon="gui/icons/mode_normal.png"
|
<icon-button id="tab_track" width="128" height="128" icon="gui/icons/mode_normal.png"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<spacer width="20" height="13" />
|
<spacer width="20" height="13" />
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<tabs width="100%" height="5%" id="trackgroups">
|
<tabs width="100%" height="1f" id="trackgroups">
|
||||||
<button id="standard" I18N="track group" text="Standard"/>
|
<button id="standard" I18N="track group" text="Standard"/>
|
||||||
<button id="addons" I18N="track group" text="Add-Ons"/>
|
<button id="addons" I18N="track group" text="Add-Ons"/>
|
||||||
<button id="all" I18N="track group" text="All"/>
|
<button id="all" I18N="track group" text="All"/>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<spacer width="20" height="13" />
|
<spacer width="20" height="13" />
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<tabs width="100%" height="5%" id="trackgroups">
|
<tabs width="100%" height="1f" id="trackgroups">
|
||||||
<button id="standard" I18N="track group" text="Standard"/>
|
<button id="standard" I18N="track group" text="Standard"/>
|
||||||
<button id="addons" I18N="track group" text="Add-Ons"/>
|
<button id="addons" I18N="track group" text="Add-Ons"/>
|
||||||
<button id="all" I18N="track group" text="All"/>
|
<button id="all" I18N="track group" text="All"/>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Populated dynamically at runtime -->
|
<!-- Populated dynamically at runtime -->
|
||||||
<tabs width="100%" height="5%" id="trackgroups"> </tabs>
|
<tabs width="100%" height="1f" id="trackgroups"> </tabs>
|
||||||
|
|
||||||
<spacer height="10%" />
|
<spacer height="10%" />
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Populated dynamically at runtime -->
|
<!-- Populated dynamically at runtime -->
|
||||||
<tabs width="100%" height="5%" id="gpgroups"> </tabs>
|
<tabs width="100%" height="1f" id="gpgroups"> </tabs>
|
||||||
|
|
||||||
<spacer height="20" />
|
<spacer height="20" />
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Groups will be added dynamically at runtime -->
|
<!-- Groups will be added dynamically at runtime -->
|
||||||
<tabs width="98%" x="1%" height="5%" id="kartgroups">
|
<tabs width="98%" x="1%" height="1f" id="kartgroups">
|
||||||
</tabs>
|
</tabs>
|
||||||
<spacer width="100%" height="2%"/>
|
<spacer width="100%" height="2%"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="0" y="0" width="100%" height="fit" layout="vertical-row">
|
<div x="0" y="0" width="100%" height="fit" layout="vertical-row">
|
||||||
<button id="user-id" width="20%" height="fit" align="right"/>
|
<button id="user-id" width="12f" height="fit" align="right"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Groups will be added dynamically at runtime -->
|
<!-- Groups will be added dynamically at runtime -->
|
||||||
<tabs width="98%" x="1%" height="5%" id="kartgroups">
|
<tabs width="98%" x="1%" height="1f" id="kartgroups">
|
||||||
</tabs>
|
</tabs>
|
||||||
<spacer width="100%" height="2%"/>
|
<spacer width="100%" height="2%"/>
|
||||||
<progressbar x="1%" id="timer" height="4%" width="98%"></progressbar>
|
<progressbar x="1%" id="timer" height="1f" width="98%"></progressbar>
|
||||||
</div>
|
</div>
|
||||||
<icon-button id="back" x="1%" y="0" height="8%" icon="gui/icons/back.png"/>
|
<icon-button id="back" x="1%" y="0" height="8%" icon="gui/icons/back.png"/>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||||
<header text_align="center" width="80%" align="center" text="Online"/>
|
<header text_align="center" width="80%" align="center" text="Online"/>
|
||||||
<spacer height="15" width="10"/>
|
<spacer height="15" width="10"/>
|
||||||
<button id="user-id" width="20%" height="fit" align="center"/>
|
<button id="user-id" width="12f" height="fit" align="center"/>
|
||||||
<spacer height="20"/>
|
<spacer height="20"/>
|
||||||
|
|
||||||
<box width="fit" height="fit" layout="horizontal-row" align="center" valign="center">
|
<box width="fit" height="fit" layout="horizontal-row" align="center" valign="center">
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<spacer width="20" height="20"/>
|
<spacer width="20" height="20"/>
|
||||||
|
|
||||||
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
|
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
|
||||||
<gauge id="gfx_level" min_value="1" max_value="8" width="300" align="center" />
|
<gauge id="gfx_level" min_value="1" max_value="8" width="8f" align="center" />
|
||||||
<spacer height="5" width="10"/>
|
<spacer height="5" width="10"/>
|
||||||
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
|
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<!-- Contents is added programatically -->
|
<!-- Contents is added programatically -->
|
||||||
</div>
|
</div>
|
||||||
</roundedbox>
|
</roundedbox>
|
||||||
<spacer height="10" width="96%"/>
|
<spacer height="1%" width="96%"/>
|
||||||
<!-- The actual button texts will vary depending on what type of race
|
<!-- The actual button texts will vary depending on what type of race
|
||||||
was being run, and if something was unlocked etc. So we don't
|
was being run, and if something was unlocked etc. So we don't
|
||||||
specify a text here, and label the buttons :
|
specify a text here, and label the buttons :
|
||||||
@ -16,9 +16,9 @@
|
|||||||
Setting text=" " is important, otherwise the height of the
|
Setting text=" " is important, otherwise the height of the
|
||||||
widget is incorrect. -->
|
widget is incorrect. -->
|
||||||
<button id="top" align="center" width="60%"/>
|
<button id="top" align="center" width="60%"/>
|
||||||
<spacer height="10" width="96%"/>
|
<spacer height="1%" width="96%"/>
|
||||||
<button id="middle" align="center" width="60%"/>
|
<button id="middle" align="center" width="60%"/>
|
||||||
<spacer height="10" width="96%"/>
|
<spacer height="1%" width="96%"/>
|
||||||
<button id="bottom" align="center" width="60%"/>
|
<button id="bottom" align="center" width="60%"/>
|
||||||
</div>
|
</div>
|
||||||
</stkgui>
|
</stkgui>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Populated dynamically at runtime -->
|
<!-- Populated dynamically at runtime -->
|
||||||
<tabs width="100%" height="5%" id="trackgroups"> </tabs>
|
<tabs width="100%" height="1f" id="trackgroups"> </tabs>
|
||||||
|
|
||||||
<spacer width="100%" height="2%" />
|
<spacer width="100%" height="2%" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -537,11 +537,6 @@ namespace UserConfigParams
|
|||||||
"Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware "
|
"Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware "
|
||||||
"keyboard, 2 = always enabled, 3 = android keyboard (experimental)") );
|
"keyboard, 2 = always enabled, 3 = android keyboard (experimental)") );
|
||||||
|
|
||||||
PARAM_PREFIX BoolUserConfigParam m_hidpi_enabled
|
|
||||||
PARAM_DEFAULT( BoolUserConfigParam(false, "hidpi_enabled",
|
|
||||||
&m_multitouch_group,
|
|
||||||
"Enable high-DPI support.") );
|
|
||||||
|
|
||||||
// ---- GP start order
|
// ---- GP start order
|
||||||
PARAM_PREFIX GroupUserConfigParam m_gp_start_order
|
PARAM_PREFIX GroupUserConfigParam m_gp_start_order
|
||||||
PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
|
PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
|
||||||
@ -648,6 +643,9 @@ namespace UserConfigParams
|
|||||||
PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap",
|
PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap",
|
||||||
&m_video_group, "Generate mipmap for textures using "
|
&m_video_group, "Generate mipmap for textures using "
|
||||||
"high quality method with SSE"));
|
"high quality method with SSE"));
|
||||||
|
PARAM_PREFIX IntUserConfigParam m_fonts_size
|
||||||
|
PARAM_DEFAULT( IntUserConfigParam(2, "fonts_size",
|
||||||
|
&m_video_group,"The size of fonts. 0 is the smallest and 4 is the biggest") );
|
||||||
|
|
||||||
// ---- Recording
|
// ---- Recording
|
||||||
PARAM_PREFIX GroupUserConfigParam m_recording_group
|
PARAM_PREFIX GroupUserConfigParam m_recording_group
|
||||||
|
@ -31,7 +31,7 @@ void BoldFace::init()
|
|||||||
{
|
{
|
||||||
FontWithFace::init();
|
FontWithFace::init();
|
||||||
// Reserve some space for characters added later
|
// Reserve some space for characters added later
|
||||||
m_font_max_height = m_glyph_max_height + 20;
|
m_font_max_height = m_glyph_max_height * 3 / 2;
|
||||||
|
|
||||||
/* Use FT_Outline_Embolden for now, no more fallback font
|
/* Use FT_Outline_Embolden for now, no more fallback font
|
||||||
setFallbackFont(font_manager->getFont<RegularFace>());
|
setFallbackFont(font_manager->getFont<RegularFace>());
|
||||||
|
@ -32,7 +32,7 @@ class BoldFace : public FontWithFace
|
|||||||
private:
|
private:
|
||||||
virtual unsigned int getGlyphPageSize() const OVERRIDE { return 1024; }
|
virtual unsigned int getGlyphPageSize() const OVERRIDE { return 1024; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual float getScalingFactorOne() const OVERRIDE { return 0.2f; }
|
virtual float getScalingFactorOne() const OVERRIDE { return 0.3f; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual unsigned int getScalingFactorTwo() const OVERRIDE { return 120; }
|
virtual unsigned int getScalingFactorTwo() const OVERRIDE { return 120; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -31,7 +31,7 @@ void DigitFace::init()
|
|||||||
{
|
{
|
||||||
FontWithFace::init();
|
FontWithFace::init();
|
||||||
|
|
||||||
m_font_max_height = m_glyph_max_height + 10;
|
m_font_max_height = m_glyph_max_height * 3 / 2;
|
||||||
|
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
@ -350,32 +350,15 @@ void FontWithFace::dumpGlyphPage()
|
|||||||
*/
|
*/
|
||||||
void FontWithFace::setDPI()
|
void FontWithFace::setDPI()
|
||||||
{
|
{
|
||||||
const int screen_width = irr_driver->getActualScreenSize().Width;
|
float scale = std::min(irr_driver->getActualScreenSize().Height,
|
||||||
const int screen_height = irr_driver->getActualScreenSize().Height;
|
irr_driver->getActualScreenSize().Width) / 720.0f;
|
||||||
|
int factorTwo = getScalingFactorTwo();
|
||||||
|
|
||||||
if (UserConfigParams::m_hidpi_enabled)
|
if(0 <= UserConfigParams::m_fonts_size && UserConfigParams::m_fonts_size <= 4)
|
||||||
{
|
factorTwo += UserConfigParams::m_fonts_size * 5 - 10;
|
||||||
float scale = screen_height / 480.0f;
|
|
||||||
m_face_dpi = int(getScalingFactorTwo() * getScalingFactorOne() * scale);
|
|
||||||
}
|
|
||||||
else if (screen_height > 1300)
|
|
||||||
{
|
|
||||||
float scale = screen_height / 480.0f * 0.45f;
|
|
||||||
m_face_dpi = int(getScalingFactorTwo() * (getScalingFactorOne() + 0.3f) * scale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float scale = std::max(0, screen_width - 640) / 564.0f;
|
|
||||||
|
|
||||||
// attempt to compensate for small screens
|
m_face_dpi = int(factorTwo * getScalingFactorOne() * scale);
|
||||||
if (screen_width < 1200)
|
|
||||||
scale = std::max(0, screen_width - 640) / 750.0f;
|
|
||||||
if (screen_width < 900 || screen_height < 700)
|
|
||||||
scale = std::min(scale, 0.05f);
|
|
||||||
|
|
||||||
m_face_dpi = unsigned((getScalingFactorOne() + 0.2f * scale) *
|
|
||||||
getScalingFactorTwo());
|
|
||||||
}
|
|
||||||
} // setDPI
|
} // setDPI
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -31,7 +31,7 @@ void RegularFace::init()
|
|||||||
{
|
{
|
||||||
FontWithFace::init();
|
FontWithFace::init();
|
||||||
// Reserve some space for characters added later
|
// Reserve some space for characters added later
|
||||||
m_font_max_height = m_glyph_max_height + 10;
|
m_font_max_height = m_glyph_max_height * 3 / 2;
|
||||||
|
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
@ -1725,10 +1725,11 @@ void IrrDriver::displayFPS()
|
|||||||
gui::IGUIFont* font = GUIEngine::getSmallFont();
|
gui::IGUIFont* font = GUIEngine::getSmallFont();
|
||||||
core::rect<s32> position;
|
core::rect<s32> position;
|
||||||
|
|
||||||
|
const int fheight = font->getDimension(L"X").Height;
|
||||||
if (UserConfigParams::m_artist_debug_mode)
|
if (UserConfigParams::m_artist_debug_mode)
|
||||||
position = core::rect<s32>(51, 0, 1100, 80);
|
position = core::rect<s32>(51, 0, 30*fheight+51, 2*fheight + fheight / 3);
|
||||||
else
|
else
|
||||||
position = core::rect<s32>(75, 0, 900, 40);
|
position = core::rect<s32>(75, 0, 18*fheight+75 , fheight + fheight / 5);
|
||||||
GL32_draw2DRectangle(video::SColor(150, 96, 74, 196), position, NULL);
|
GL32_draw2DRectangle(video::SColor(150, 96, 74, 196), position, NULL);
|
||||||
// We will let pass some time to let things settle before trusting FPS counter
|
// We will let pass some time to let things settle before trusting FPS counter
|
||||||
// even if we also ignore fps = 1, which tends to happen in first checks
|
// even if we also ignore fps = 1, which tends to happen in first checks
|
||||||
|
@ -1347,7 +1347,7 @@ namespace GUIEngine
|
|||||||
true/* center h */, false /* center v */ );
|
true/* center h */, false /* center v */ );
|
||||||
|
|
||||||
const int icon_count = (int)g_loading_icons.size();
|
const int icon_count = (int)g_loading_icons.size();
|
||||||
const int icon_size = (int)(screen_w / 16.0f);
|
const int icon_size = (int)(std::min(screen_w, screen_h) / 10.0f);
|
||||||
const int ICON_MARGIN = 6;
|
const int ICON_MARGIN = 6;
|
||||||
int x = ICON_MARGIN;
|
int x = ICON_MARGIN;
|
||||||
int y = screen_h - icon_size - ICON_MARGIN;
|
int y = screen_h - icon_size - ICON_MARGIN;
|
||||||
|
@ -64,6 +64,11 @@ bool LayoutManager::convertToCoord(std::string& x, int* absolute /* out */, int*
|
|||||||
*percentage = i;
|
*percentage = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if( x[x.size()-1] == 'f' ) // font height
|
||||||
|
{
|
||||||
|
*absolute = i * GUIEngine::getFontHeight();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else // absolute number
|
else // absolute number
|
||||||
{
|
{
|
||||||
*absolute = i;
|
*absolute = i;
|
||||||
@ -242,7 +247,7 @@ void LayoutManager::readCoords(Widget* self)
|
|||||||
//Add padding to <box> elements
|
//Add padding to <box> elements
|
||||||
if (self->getType() == WTYPE_DIV && self->m_show_bounding_box)
|
if (self->getType() == WTYPE_DIV && self->m_show_bounding_box)
|
||||||
{
|
{
|
||||||
int padding = 15;
|
int padding = GUIEngine::getFontHeight() / 2;
|
||||||
if (self->m_properties[PROP_DIV_PADDING].length() > 0)
|
if (self->m_properties[PROP_DIV_PADDING].length() > 0)
|
||||||
padding = atoi(self->m_properties[PROP_DIV_PADDING].c_str());
|
padding = atoi(self->m_properties[PROP_DIV_PADDING].c_str());
|
||||||
child_max_height += padding * 2;
|
child_max_height += padding * 2;
|
||||||
@ -317,7 +322,7 @@ void LayoutManager::applyCoords(Widget* self, AbstractTopLevelContainer* topLeve
|
|||||||
|
|
||||||
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
|
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
|
||||||
{
|
{
|
||||||
int padding = 15;
|
int padding = GUIEngine::getFontHeight() / 2;
|
||||||
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
|
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
|
||||||
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
|
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
|
||||||
|
|
||||||
@ -443,7 +448,7 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
|
|
||||||
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
|
if (parent != NULL && parent->getType() == WTYPE_DIV && parent->m_show_bounding_box)
|
||||||
{
|
{
|
||||||
int padding = 15;
|
int padding = GUIEngine::getFontHeight() / 2;
|
||||||
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
|
if (parent->m_properties[PROP_DIV_PADDING].length() > 0)
|
||||||
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
|
padding = atoi(parent->m_properties[PROP_DIV_PADDING].c_str());
|
||||||
|
|
||||||
@ -508,6 +513,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
prop_y = prop_y.substr(0, prop_y.size() - 1);
|
prop_y = prop_y.substr(0, prop_y.size() - 1);
|
||||||
widgets[n].m_y = (int)(y + atoi_p(prop_y.c_str())/100.0f * h);
|
widgets[n].m_y = (int)(y + atoi_p(prop_y.c_str())/100.0f * h);
|
||||||
}
|
}
|
||||||
|
else if(prop_y[ prop_y.size()-1 ] == 'f')
|
||||||
|
{
|
||||||
|
widgets[n].m_y = y + atoi_p(prop_y.c_str()) * GUIEngine::getFontHeight();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgets[n].m_y = y + atoi_p(prop_y.c_str());
|
widgets[n].m_y = y + atoi_p(prop_y.c_str());
|
||||||
@ -583,6 +592,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
prop_x = prop_x.substr(0, prop_x.size() - 1);
|
prop_x = prop_x.substr(0, prop_x.size() - 1);
|
||||||
widgets[n].m_x = (int)(x + atoi_p(prop_x.c_str())/100.0f * w);
|
widgets[n].m_x = (int)(x + atoi_p(prop_x.c_str())/100.0f * w);
|
||||||
}
|
}
|
||||||
|
else if(prop_x[ prop_x.size()-1 ] == 'f')
|
||||||
|
{
|
||||||
|
widgets[n].m_x = x + atoi_p(prop_x.c_str()) * GUIEngine::getFontHeight();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgets[n].m_x = x + atoi_p(prop_x.c_str());
|
widgets[n].m_x = x + atoi_p(prop_x.c_str());
|
||||||
@ -637,6 +650,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
prop_y = prop_y.substr(0, prop_y.size() - 1);
|
prop_y = prop_y.substr(0, prop_y.size() - 1);
|
||||||
widgets[n].m_y = (int)(y + atoi_p(prop_y.c_str())/100.0f * h);
|
widgets[n].m_y = (int)(y + atoi_p(prop_y.c_str())/100.0f * h);
|
||||||
}
|
}
|
||||||
|
else if(prop_y[ prop_y.size()-1 ] == 'f')
|
||||||
|
{
|
||||||
|
widgets[n].m_y = y + atoi_p(prop_y.c_str()) * GUIEngine::getFontHeight();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgets[n].m_y = y + atoi_p(prop_y.c_str());
|
widgets[n].m_y = y + atoi_p(prop_y.c_str());
|
||||||
@ -683,6 +700,10 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
prop_x = prop_x.substr(0, prop_x.size() - 1);
|
prop_x = prop_x.substr(0, prop_x.size() - 1);
|
||||||
widgets[n].m_x = (int)(x + atoi_p(prop_x.c_str())/100.0f * w);
|
widgets[n].m_x = (int)(x + atoi_p(prop_x.c_str())/100.0f * w);
|
||||||
}
|
}
|
||||||
|
else if(prop_x[ prop_x.size()-1 ] == 'f')
|
||||||
|
{
|
||||||
|
widgets[n].m_x = x + atoi_p(prop_x.c_str()) * GUIEngine::getFontHeight();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widgets[n].m_x = x + atoi_p(prop_x.c_str());
|
widgets[n].m_x = x + atoi_p(prop_x.c_str());
|
||||||
|
@ -152,15 +152,9 @@ void DynamicRibbonWidget::add()
|
|||||||
|
|
||||||
const int average_y = m_y + (m_h - m_label_height)/2;
|
const int average_y = m_y + (m_h - m_label_height)/2;
|
||||||
|
|
||||||
unsigned int screen_height = irr_driver->getActualScreenSize().Height;
|
m_arrows_w = GUIEngine::getFontHeight() * 2;
|
||||||
m_arrows_w = (int)(screen_height / 15);
|
|
||||||
m_arrows_w = std::max(m_arrows_w, 40);
|
m_arrows_w = std::max(m_arrows_w, 40);
|
||||||
|
|
||||||
if (UserConfigParams::m_hidpi_enabled)
|
|
||||||
{
|
|
||||||
m_arrows_w = int(m_arrows_w*1.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
const int button_h = m_arrows_w;
|
const int button_h = m_arrows_w;
|
||||||
|
|
||||||
// right arrow
|
// right arrow
|
||||||
|
@ -69,7 +69,7 @@ void override_default_params()
|
|||||||
UserConfigParams::m_screen_keyboard = 1;
|
UserConfigParams::m_screen_keyboard = 1;
|
||||||
|
|
||||||
// Set bigger fonts and buttons
|
// Set bigger fonts and buttons
|
||||||
UserConfigParams::m_hidpi_enabled = true;
|
UserConfigParams::m_fonts_size = 4;
|
||||||
|
|
||||||
// It shouldn't matter, but STK is always run in fullscreen on android
|
// It shouldn't matter, but STK is always run in fullscreen on android
|
||||||
UserConfigParams::m_fullscreen = true;
|
UserConfigParams::m_fullscreen = true;
|
||||||
|
@ -173,11 +173,8 @@ void GhostReplaySelection::init()
|
|||||||
Screen::init();
|
Screen::init();
|
||||||
m_cur_difficulty = race_manager->getDifficulty();
|
m_cur_difficulty = race_manager->getDifficulty();
|
||||||
|
|
||||||
int icon_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 15
|
int icon_height = GUIEngine::getFontHeight() * 3 / 2;
|
||||||
: getHeight() / 24;
|
int row_height = GUIEngine::getFontHeight() * 2;
|
||||||
|
|
||||||
int row_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 12
|
|
||||||
: getHeight() / 24;
|
|
||||||
|
|
||||||
// 128 is the height of the image file
|
// 128 is the height of the image file
|
||||||
m_icon_bank->setScale(icon_height/128.0f);
|
m_icon_bank->setScale(icon_height/128.0f);
|
||||||
|
@ -79,7 +79,7 @@ MainMenuScreen::MainMenuScreen() : Screen("main_menu.stkgui")
|
|||||||
void MainMenuScreen::loadedFromFile()
|
void MainMenuScreen::loadedFromFile()
|
||||||
{
|
{
|
||||||
LabelWidget* w = getWidget<LabelWidget>("info_addons");
|
LabelWidget* w = getWidget<LabelWidget>("info_addons");
|
||||||
w->setScrollSpeed(15);
|
w->setScrollSpeed(GUIEngine::getFontHeight() / 2);
|
||||||
|
|
||||||
RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow");
|
RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow");
|
||||||
assert(rw_top != NULL);
|
assert(rw_top != NULL);
|
||||||
|
@ -134,15 +134,7 @@ void NetworkingLobby::loadedFromFile()
|
|||||||
m_icon_bank->addTextureAsSprite(icon_5);
|
m_icon_bank->addTextureAsSprite(icon_5);
|
||||||
m_icon_bank->addTextureAsSprite(m_spectate_texture);
|
m_icon_bank->addTextureAsSprite(m_spectate_texture);
|
||||||
|
|
||||||
if (UserConfigParams::m_hidpi_enabled)
|
m_icon_bank->setScale((float)GUIEngine::getFontHeight() / 96.0f);
|
||||||
{
|
|
||||||
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
|
} // loadedFromFile
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -137,7 +137,7 @@ void ServerSelection::init()
|
|||||||
m_searcher->clearListeners();
|
m_searcher->clearListeners();
|
||||||
m_searcher->addListener(this);
|
m_searcher->addListener(this);
|
||||||
|
|
||||||
m_icon_bank->setScale((float)getHeight() / 15.0f / 128.0f);
|
m_icon_bank->setScale((float)GUIEngine::getFontHeight() / 96.0f);
|
||||||
m_icon_bank->setTargetIconSize(128, 128);
|
m_icon_bank->setTargetIconSize(128, 128);
|
||||||
|
|
||||||
video::ITexture* icon1 = irr_driver->getTexture(
|
video::ITexture* icon1 = irr_driver->getTexture(
|
||||||
@ -159,8 +159,7 @@ void ServerSelection::init()
|
|||||||
m_icon_bank->addTextureAsSprite(tex);
|
m_icon_bank->addTextureAsSprite(tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int row_height = UserConfigParams::m_hidpi_enabled ? getHeight() / 12
|
int row_height = GUIEngine::getFontHeight() * 3 / 2;
|
||||||
: getHeight() / 15;
|
|
||||||
|
|
||||||
m_server_list_widget->setIcons(m_icon_bank, row_height);
|
m_server_list_widget->setIcons(m_icon_bank, row_height);
|
||||||
m_sort_desc = false;
|
m_sort_desc = false;
|
||||||
|
@ -113,7 +113,8 @@ RaceGUI::RaceGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Originally m_map_height was 100, and we take 480 as minimum res
|
// Originally m_map_height was 100, and we take 480 as minimum res
|
||||||
float scaling = irr_driver->getFrameSize().Height / 480.0f;
|
float scaling = std::min(irr_driver->getFrameSize().Height,
|
||||||
|
irr_driver->getFrameSize().Width) / 480.0f;
|
||||||
const float map_size = stk_config->m_minimap_size * map_size_splitscreen;
|
const float map_size = stk_config->m_minimap_size * map_size_splitscreen;
|
||||||
const float top_margin = 3.5f * m_font_height;
|
const float top_margin = 3.5f * m_font_height;
|
||||||
|
|
||||||
|
@ -529,6 +529,8 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
|
|
||||||
gui::IGUIFont* font = GUIEngine::getFont();
|
gui::IGUIFont* font = GUIEngine::getFont();
|
||||||
|
|
||||||
|
const int fheight = font->getDimension(L"X").Height;
|
||||||
|
|
||||||
float race_time =
|
float race_time =
|
||||||
stk_config->ticks2Time(World::getWorld()->getMusicDescriptionTicks());
|
stk_config->ticks2Time(World::getWorld()->getMusicDescriptionTicks());
|
||||||
|
|
||||||
@ -536,8 +538,8 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
float timeProgression = (float)(race_time) /
|
float timeProgression = (float)(race_time) /
|
||||||
(float)(stk_config->m_music_credit_time);
|
(float)(stk_config->m_music_credit_time);
|
||||||
|
|
||||||
const int x_pulse = (int)(sinf(race_time*9.0f)*10.0f);
|
const int x_pulse = (int)(sinf(race_time*9.0f)*fheight/4);
|
||||||
const int y_pulse = (int)(cosf(race_time*9.0f)*10.0f);
|
const int y_pulse = (int)(cosf(race_time*9.0f)*fheight/4);
|
||||||
|
|
||||||
float resize = 1.0f;
|
float resize = 1.0f;
|
||||||
if (timeProgression < 0.1)
|
if (timeProgression < 0.1)
|
||||||
@ -574,27 +576,27 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
if (textWidth > max_text_size) textWidth = max_text_size;
|
if (textWidth > max_text_size) textWidth = max_text_size;
|
||||||
if (textWidth2 > max_text_size) textWidth2 = max_text_size;
|
if (textWidth2 > max_text_size) textWidth2 = max_text_size;
|
||||||
|
|
||||||
const int ICON_SIZE = 64;
|
const int ICON_SIZE = fheight*2;
|
||||||
const int y = irr_driver->getActualScreenSize().Height - 80;
|
const int y = irr_driver->getActualScreenSize().Height - fheight*5/2;
|
||||||
// the 20 is an arbitrary space left between the note icon and the text
|
// the fheight/2 is an arbitrary space left between the note icon and the text
|
||||||
const int noteX = (irr_driver->getActualScreenSize().Width / 2)
|
const int noteX = (irr_driver->getActualScreenSize().Width / 2)
|
||||||
- std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - 20;
|
- std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - fheight;
|
||||||
const int noteY = y;
|
const int noteY = y;
|
||||||
// the 20 is an arbitrary space left between the note icon and the text
|
// the fheight is an arbitrary space left between the note icon and the text
|
||||||
const int textXFrom = (irr_driver->getActualScreenSize().Width / 2)
|
const int textXFrom = (irr_driver->getActualScreenSize().Width / 2)
|
||||||
- std::max(textWidth, textWidth2)/2 + 20;
|
- std::max(textWidth, textWidth2)/2 + fheight;
|
||||||
const int textXTo = (irr_driver->getActualScreenSize().Width / 2)
|
const int textXTo = (irr_driver->getActualScreenSize().Width / 2)
|
||||||
+ std::max(textWidth, textWidth2)/2 + 20;
|
+ std::max(textWidth, textWidth2)/2 + fheight;
|
||||||
|
|
||||||
// ---- Draw "by" text
|
// ---- Draw "by" text
|
||||||
const int text_y = (int)(irr_driver->getActualScreenSize().Height - 80*(resize3)
|
const int text_y = (int)(irr_driver->getActualScreenSize().Height
|
||||||
+ 40*(1-resize));
|
- fheight*2*(resize3) + fheight*(1-resize));
|
||||||
|
|
||||||
static const video::SColor white = video::SColor(255, 255, 255, 255);
|
static const video::SColor white = video::SColor(255, 255, 255, 255);
|
||||||
if(mi->getComposer()!="")
|
if(mi->getComposer()!="")
|
||||||
{
|
{
|
||||||
core::rect<s32> pos_by(textXFrom, text_y+40,
|
core::rect<s32> pos_by(textXFrom, text_y+fheight,
|
||||||
textXTo, text_y+40);
|
textXTo, text_y+fheight);
|
||||||
font->draw(thetext_composer, pos_by, white,
|
font->draw(thetext_composer, pos_by, white,
|
||||||
true, true);
|
true, true);
|
||||||
}
|
}
|
||||||
@ -612,9 +614,9 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
||||||
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
||||||
|
|
||||||
core::rect<s32> dest(noteX-iconSizeX/2+20,
|
core::rect<s32> dest(noteX-iconSizeX/2+fheight,
|
||||||
noteY-iconSizeY/2+ICON_SIZE/2,
|
noteY-iconSizeY/2+ICON_SIZE/2,
|
||||||
noteX+iconSizeX/2+20,
|
noteX+iconSizeX/2+fheight,
|
||||||
noteY+iconSizeY/2+ICON_SIZE/2);
|
noteY+iconSizeY/2+ICON_SIZE/2);
|
||||||
const core::rect<s32> source(core::position2d<s32>(0,0),
|
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||||
m_music_icon->getSize());
|
m_music_icon->getSize());
|
||||||
|
@ -86,7 +86,8 @@ RaceGUIOverworld::RaceGUIOverworld()
|
|||||||
m_trophy[2] = irr_driver->getTexture(FileManager::GUI_ICON, "cup_gold.png" );
|
m_trophy[2] = irr_driver->getTexture(FileManager::GUI_ICON, "cup_gold.png" );
|
||||||
m_trophy[3] = irr_driver->getTexture(FileManager::GUI_ICON, "cup_platinum.png" );
|
m_trophy[3] = irr_driver->getTexture(FileManager::GUI_ICON, "cup_platinum.png" );
|
||||||
|
|
||||||
float scaling = irr_driver->getFrameSize().Height / 420.0f;
|
float scaling = std::min(irr_driver->getFrameSize().Height,
|
||||||
|
irr_driver->getFrameSize().Width) / 420.0f;
|
||||||
const float map_size = 250.0f;
|
const float map_size = 250.0f;
|
||||||
|
|
||||||
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
|
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
|
||||||
@ -242,7 +243,8 @@ void RaceGUIOverworld::drawTrophyPoints()
|
|||||||
|
|
||||||
bool vcenter = true;
|
bool vcenter = true;
|
||||||
|
|
||||||
const int size = irr_driver->getActualScreenSize().Width/20;
|
const int size = std::min((int)irr_driver->getActualScreenSize().Width/20,
|
||||||
|
2 * GUIEngine::getFontHeight());
|
||||||
core::rect<s32> dest(size, pos.UpperLeftCorner.Y,
|
core::rect<s32> dest(size, pos.UpperLeftCorner.Y,
|
||||||
size*2, pos.UpperLeftCorner.Y + size);
|
size*2, pos.UpperLeftCorner.Y + size);
|
||||||
core::rect<s32> source(core::position2di(0, 0), m_trophy[3]->getSize());
|
core::rect<s32> source(core::position2di(0, 0), m_trophy[3]->getSize());
|
||||||
|
Loading…
Reference in New Issue
Block a user