Remove hasHardwareKeyboard because it's not reliable in iOS
This commit is contained in:
parent
89a57e6e19
commit
07f6282142
@ -24,6 +24,7 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/render_info.hpp"
|
||||
#include "guiengine/message_queue.hpp"
|
||||
#include "guiengine/widgets/bubble_widget.hpp"
|
||||
#include "guiengine/widgets/kart_stats_widget.hpp"
|
||||
#include "guiengine/widgets/model_view_widget.hpp"
|
||||
@ -268,8 +269,6 @@ void KartSelectionScreen::loadedFromFile()
|
||||
|
||||
void KartSelectionScreen::beforeAddingWidget()
|
||||
{
|
||||
m_has_external_keyboard = irr_driver->getDevice()->hasHardwareKeyboard();
|
||||
m_has_external_gamepad = input_manager->getGamepadCount() > 0;
|
||||
if (useContinueButton())
|
||||
{
|
||||
getWidget("kartlist")->m_properties[GUIEngine::PROP_WIDTH] = "85%";
|
||||
@ -369,7 +368,9 @@ void KartSelectionScreen::init()
|
||||
|
||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||
assert( w != NULL );
|
||||
|
||||
// Only allow keyboard and gamepad to choose kart without continue button in
|
||||
// multitouch GUI, so mouse (touch) clicking can be used as previewing karts
|
||||
w->setEventCallbackActive(Input::IT_MOUSEBUTTON, !useContinueButton());
|
||||
|
||||
KartHoverListener* karthoverListener = new KartHoverListener(this);
|
||||
w->registerHoverListener(karthoverListener);
|
||||
@ -428,6 +429,10 @@ void KartSelectionScreen::init()
|
||||
{
|
||||
// Add multiplayer message
|
||||
addMultiplayerMessage();
|
||||
#ifdef MOBILE_STK
|
||||
MessageQueue::addStatic(MessageQueue::MT_GENERIC,
|
||||
_("Connect a keyboard or gamepad to play splitscreen multiplayer"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // init
|
||||
@ -436,6 +441,10 @@ void KartSelectionScreen::init()
|
||||
|
||||
void KartSelectionScreen::tearDown()
|
||||
{
|
||||
#ifdef MOBILE_STK
|
||||
if (m_multiplayer)
|
||||
MessageQueue::discardStatic();
|
||||
#endif
|
||||
// Reset the 'map fire to select' option of the device manager
|
||||
input_manager->getDeviceManager()->mapFireToSelect(false);
|
||||
|
||||
@ -470,6 +479,10 @@ void KartSelectionScreen::unloaded()
|
||||
// Return true if event was handled successfully
|
||||
bool KartSelectionScreen::joinPlayer(InputDevice* device, PlayerProfile* p)
|
||||
{
|
||||
#ifdef MOBILE_STK
|
||||
if (m_multiplayer)
|
||||
MessageQueue::discardStatic();
|
||||
#endif
|
||||
bool first_player = m_kart_widgets.size() == 0;
|
||||
|
||||
if (UserConfigParams::logGUI())
|
||||
@ -1010,16 +1023,8 @@ void KartSelectionScreen::addMultiplayerMessage()
|
||||
{
|
||||
m_multiplayer_message = new BubbleWidget();
|
||||
m_multiplayer_message->m_properties[PROP_TEXT_ALIGN] = "center";
|
||||
if (!m_has_external_keyboard && !m_has_external_gamepad)
|
||||
{
|
||||
m_multiplayer_message->setText(_("Connect a keyboard or "
|
||||
"gamepad to play splitscreen multiplayer"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_multiplayer_message->setText(_("Everyone:\n"
|
||||
"Press the 'Select' button to join the game"));
|
||||
}
|
||||
m_multiplayer_message->setText(_("Everyone:\n"
|
||||
"Press the 'Select' button to join the game"));
|
||||
m_multiplayer_message->m_x = message_x;
|
||||
m_multiplayer_message->m_y = (int) (fullarea->m_y + fullarea->m_h * 0.3f);
|
||||
m_multiplayer_message->m_w = (int) (splitWidth * 0.6f);
|
||||
@ -1130,14 +1135,12 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "karts")
|
||||
{
|
||||
if (!useContinueButton() &&
|
||||
m_kart_widgets.size() > unsigned(player_id))
|
||||
if (m_kart_widgets.size() > unsigned(player_id))
|
||||
playerConfirm(player_id);
|
||||
}
|
||||
else if (name == "continue")
|
||||
{
|
||||
if (useContinueButton() &&
|
||||
m_kart_widgets.size() > unsigned(player_id))
|
||||
if (m_kart_widgets.size() > unsigned(player_id))
|
||||
playerConfirm(player_id);
|
||||
}
|
||||
else if (name == "back")
|
||||
@ -1592,14 +1595,16 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
||||
// ----------------------------------------------------------------------------
|
||||
bool KartSelectionScreen::useContinueButton() const
|
||||
{
|
||||
#ifdef MOBILE_STK
|
||||
if (m_multiplayer)
|
||||
return false;
|
||||
if (m_has_external_keyboard || m_has_external_gamepad)
|
||||
return false;
|
||||
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
|
||||
irr_driver->getDevice()->supportsTouchDevice()) ||
|
||||
UserConfigParams::m_multitouch_active > 1;
|
||||
return multitouch_enabled;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
} // useContinueButton
|
||||
|
||||
#if 0
|
||||
|
@ -76,10 +76,6 @@ protected:
|
||||
*/
|
||||
bool m_game_master_confirmed;
|
||||
|
||||
/** For mobile STK to handle the continue button */
|
||||
bool m_has_external_keyboard;
|
||||
bool m_has_external_gamepad;
|
||||
|
||||
GUIEngine::PlayerKartWidget* m_removed_widget;
|
||||
|
||||
/** Message shown in multiplayer mode */
|
||||
|
Loading…
Reference in New Issue
Block a user