From 2d3ae6aefcd44be8c0657c19a49b7003a231e00d Mon Sep 17 00:00:00 2001 From: dumaosen <35170687+dumaosen@users.noreply.github.com> Date: Sat, 18 May 2019 03:42:45 +0800 Subject: [PATCH] UI fix bundle V (#3921) * Use font height * Smarter space * Smarter space * Better space to avoid bad looking ui * Smarter space * Use font height * Better height * Better skill bar look * Better skill bars look --- data/gui/dialogs/addons_loading.stkgui | 2 +- .../dialogs/confirm_resolution_dialog.stkgui | 6 +++--- .../dialogs/online/server_info_dialog.stkgui | 4 ++-- .../dialogs/online/user_info_dialog.stkgui | 6 +++--- data/gui/screens/karts.stkgui | 2 +- data/gui/screens/online/create_server.stkgui | 12 +++++------ data/gui/screens/tracks.stkgui | 4 ++-- src/guiengine/widgets/kart_stats_widget.cpp | 20 +++++-------------- src/guiengine/widgets/skill_level_widget.cpp | 18 +++++------------ 9 files changed, 28 insertions(+), 46 deletions(-) diff --git a/data/gui/dialogs/addons_loading.stkgui b/data/gui/dialogs/addons_loading.stkgui index 0c86b451f..ac22cecae 100644 --- a/data/gui/dialogs/addons_loading.stkgui +++ b/data/gui/dialogs/addons_loading.stkgui @@ -36,7 +36,7 @@ icon="gui/icons/back.png" I18N="Add-on screen action" text="Back" /> - + diff --git a/data/gui/dialogs/confirm_resolution_dialog.stkgui b/data/gui/dialogs/confirm_resolution_dialog.stkgui index f0fdf2d15..a82e7f4c3 100644 --- a/data/gui/dialogs/confirm_resolution_dialog.stkgui +++ b/data/gui/dialogs/confirm_resolution_dialog.stkgui @@ -3,16 +3,16 @@
diff --git a/data/gui/dialogs/online/server_info_dialog.stkgui b/data/gui/dialogs/online/server_info_dialog.stkgui index 17040864d..1c8cacbac 100644 --- a/data/gui/dialogs/online/server_info_dialog.stkgui +++ b/data/gui/dialogs/online/server_info_dialog.stkgui @@ -2,7 +2,7 @@
- +
diff --git a/data/gui/dialogs/online/user_info_dialog.stkgui b/data/gui/dialogs/online/user_info_dialog.stkgui index 61fdae86f..eb8af8202 100644 --- a/data/gui/dialogs/online/user_info_dialog.stkgui +++ b/data/gui/dialogs/online/user_info_dialog.stkgui @@ -4,7 +4,7 @@
- +
@@ -12,11 +12,11 @@
- +
- +
- +
- +
diff --git a/data/gui/screens/tracks.stkgui b/data/gui/screens/tracks.stkgui index 14658e770..3a10596f0 100644 --- a/data/gui/screens/tracks.stkgui +++ b/data/gui/screens/tracks.stkgui @@ -14,7 +14,7 @@ - + @@ -41,5 +41,5 @@ - + diff --git a/src/guiengine/widgets/kart_stats_widget.cpp b/src/guiengine/widgets/kart_stats_widget.cpp index 315fe997e..47c941fba 100644 --- a/src/guiengine/widgets/kart_stats_widget.cpp +++ b/src/guiengine/widgets/kart_stats_widget.cpp @@ -165,10 +165,8 @@ void KartStatsWidget::move(int x, int y, int w, int h) { Widget::move(x,y,w,h); setSize(m_x, m_y, m_w, m_h); - int margin = m_h / SKILL_COUNT - m_skill_bar_h / 2; - if (margin > m_skill_bar_h) - margin = m_skill_bar_h; - int offset = (m_h - (SKILL_COUNT * margin)) / 2; + int margin = m_h / SKILL_COUNT / 2; + int offset = m_h / 4; for (int i = 0; i < SKILL_COUNT; ++i) { m_skills[i]->move(m_skill_bar_x, @@ -192,7 +190,7 @@ void KartStatsWidget::setValue(Stats type, float value) float KartStatsWidget::getValue(Stats type) { return m_skills[type]->getValue(); -} // getVAlue +} // getValue // ----------------------------------------------------------------------------- /** Set size for widgets inside KartStatsWidget @@ -205,18 +203,10 @@ void KartStatsWidget::setSize(const int x, const int y, const int w, const int h m_h = h; // -- sizes - m_skill_bar_w = w; - m_skill_bar_h = (m_title_font ? GUIEngine::getTitleFontHeight() : GUIEngine::getFontHeight()); - - // for shrinking effect - if (h < 175) - { - const float factor = h / 175.0f; - m_skill_bar_h = (int)(m_skill_bar_h*factor); - } + m_skill_bar_w = w - m_w / 32; // make sure the bars can't be out of screen + m_skill_bar_h = m_h / SKILL_COUNT / 4; m_skill_bar_x = x; - m_skill_bar_y = y + h/2 - m_skill_bar_h/2; } // setSize // ----------------------------------------------------------------------------- diff --git a/src/guiengine/widgets/skill_level_widget.cpp b/src/guiengine/widgets/skill_level_widget.cpp index 887076268..8e9e1444a 100644 --- a/src/guiengine/widgets/skill_level_widget.cpp +++ b/src/guiengine/widgets/skill_level_widget.cpp @@ -120,28 +120,20 @@ void SkillLevelWidget::setSize(const int x, const int y, const int w, const int m_w = w; m_h = h; - int iconbox_h = h; //within icon box, icon is drawn at 75% size - int iconbox_w = h; //assuming square icon + int iconbox_h = h * 4 / 3; + int iconbox_w = h * 4 / 3; //assuming square icon - m_iconbutton_h = iconbox_h * 3 / 4; - m_iconbutton_w = iconbox_w * 3 / 4; + m_iconbutton_h = iconbox_h; + m_iconbutton_w = iconbox_w; // -- sizes m_bar_w = m_w - iconbox_w - 25; //leaving just enough space for icon + its margin m_bar_h = h; - - // for shrinking effect - if (h < 175) - { - const float factor = h / 175.0f; - m_bar_h = (int)(m_bar_h*factor); - // no scale effect for icon (becomes too small otherwise) - } m_bar_x = x + iconbox_w; m_bar_y = y + h/2 - m_bar_h/2; //align to midpoint in y direction - m_iconbutton_x = x; + m_iconbutton_x = x - m_w / 32; //make sure icon has enough space on the right m_iconbutton_y = y + h/2 - m_iconbutton_h/2; //align to midpoint in y direction } // setSize