Change help for touch device

This commit is contained in:
Benau 2020-03-15 13:55:40 +08:00
parent 840a8cbb2d
commit 7174bcb741
2 changed files with 18 additions and 2 deletions

View File

@ -27,7 +27,7 @@
<spacer width="2%" height="100%"/>
<box width="78%" height="100%" layout="vertical-row">
<label width="100%"
<label id="help1" width="100%"
I18N="In the input configuration screen"
text="Press enter or double-click on a device to configure it"
text_align="center" />
@ -42,7 +42,7 @@
<button id="add_device" I18N="In the input configuration screen" text="Add a device" align="center"/>
<label I18N="In the input configuration screen" text="* Which config to use will be inferred from which 'Select' key is pressed to join the game."
<label id="help2" I18N="In the input configuration screen" text="* Which config to use will be inferred from which 'Select' key is pressed to join the game."
proportion="2" word_wrap="true"/>
</box>
</div>

View File

@ -17,6 +17,7 @@
#include "states_screens/options/options_screen_input.hpp"
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/CGUISpriteBank.hpp"
#include "guiengine/screen.hpp"
@ -201,6 +202,21 @@ void OptionsScreenInput::init()
// Disable adding keyboard configurations
bool in_game = StateManager::get()->getGameState() == GUIEngine::INGAME_MENU;
getWidget<ButtonWidget>("add_device")->setActive(!in_game);
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
irr_driver->getDevice()->supportsTouchDevice()) ||
UserConfigParams::m_multitouch_active > 1;
if (multitouch_enabled)
{
// I18N: In the input configuration screen, help for touch device
getWidget("help1")->setText(_("Tap on a device to configure it"));
getWidget("help2")->setVisible(false);
}
else
{
getWidget("help1")->setText(_("Press enter or double-click on a device to configure it"));
getWidget("help2")->setVisible(true);
}
} // init
// -----------------------------------------------------------------------------