Add an option to put the minimap on the center of screen. (#4087)

* Add an option to put the minimap in the center of screen.
This commit is contained in:
Luffah 2019-10-17 21:03:46 +02:00 committed by Alayan-stk-2
parent d4d34498ad
commit aa9b2e7008
4 changed files with 17 additions and 2 deletions

View File

@ -5246,6 +5246,11 @@ msgstr ""
msgid "Hidden"
msgstr ""
#. I18N: In the UI options, minimap position in the race UI
#: src/states_screens/options/options_screen_ui.cpp:142
msgid "Centered"
msgstr ""
#. I18N: In the UI options, Very small font size
#: src/states_screens/options/options_screen_ui.cpp:159
msgid "Very small"

View File

@ -924,7 +924,7 @@ namespace UserConfigParams
PARAM_PREFIX IntUserConfigParam m_minimap_display
PARAM_DEFAULT(IntUserConfigParam(0, "minimap_display",
"Minimap: 0 bottom-left, 1 middle-right, 2 hidden"));
"Minimap: 0 bottom-left, 1 middle-right, 2 hidden, 3 center"));
// ---- Handicap
PARAM_PREFIX GroupUserConfigParam m_handicap

View File

@ -138,6 +138,8 @@ void OptionsScreenUI::loadedFromFile()
minimap_options->addLabel( core::stringw(_("On the right side")));
//I18N: In the UI options, minimap position in the race UI
minimap_options->addLabel( core::stringw(_("Hidden")));
//I18N: In the UI options, minimap position in the race UI
minimap_options->addLabel( core::stringw(_("Centered")));
minimap_options->m_properties[GUIEngine::PROP_MIN_VALUE] = "0";
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
@ -148,7 +150,7 @@ void OptionsScreenUI::loadedFromFile()
{
minimap_options->m_properties[GUIEngine::PROP_MIN_VALUE] = "1";
}
minimap_options->m_properties[GUIEngine::PROP_MAX_VALUE] = "2";
minimap_options->m_properties[GUIEngine::PROP_MAX_VALUE] = "3";
GUIEngine::SpinnerWidget* font_size = getWidget<GUIEngine::SpinnerWidget>("font_size");
assert( font_size != NULL );

View File

@ -219,6 +219,14 @@ void RaceGUI::calculateMinimapSize()
m_map_bottom = (int)(3*irr_driver->getActualScreenSize().Height/4 -
m_map_height);
}
else if ((UserConfigParams::m_minimap_display == 3 && /*map on the center of the screen*/
race_manager->getNumLocalPlayers() == 1) || m_multitouch_gui)
{
m_map_left = (int)(irr_driver->getActualScreenSize().Width / 2);
if (m_map_left + m_map_width > (int)irr_driver->getActualScreenSize().Width)
m_map_left = (int)(irr_driver->getActualScreenSize().Width - m_map_width);
m_map_bottom = (int)( 10.0f * scaling);
}
else // default, map in the bottom-left corner
{
m_map_left = (int)( 10.0f * scaling);