Add a continue button for multitouch device in kart selection
This commit is contained in:
parent
db95d2f88f
commit
b816f94269
@ -7,21 +7,26 @@
|
|||||||
align="center" text_align="center" />
|
align="center" text_align="center" />
|
||||||
<spacer height="1%" width="25"/>
|
<spacer height="1%" width="25"/>
|
||||||
|
|
||||||
<placeholder id="playerskarts" width="100%" align="center" proportion="4">
|
<placeholder id="playerskarts" width="100%" height="70%" align="center" proportion="4">
|
||||||
<!-- Contents is added programatically -->
|
<!-- Contents is added programatically -->
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
|
||||||
<spacer height="1f" width="25"/>
|
<spacer height="1f"/>
|
||||||
|
<div width="100%" height="30%" layout="horizontal-row" >
|
||||||
<box proportion="2" width="100%" layout="vertical-row" padding="2">
|
<div id="kartlist" width="90%" height="100%" layout="vertical-row" >
|
||||||
<ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center"
|
<box proportion="2" width="100%" layout="vertical-row" padding="2">
|
||||||
child_width="90" child_height="90" max_rows="2"/>
|
<ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center"
|
||||||
</box>
|
child_width="90" child_height="90" max_rows="2"/>
|
||||||
|
</box>
|
||||||
<!-- Groups will be added dynamically at runtime -->
|
<!-- Groups will be added dynamically at runtime -->
|
||||||
<tabs width="98%" x="1%" height="1f" id="kartgroups">
|
<tabs width="98%" x="1%" height="1f" id="kartgroups">
|
||||||
</tabs>
|
</tabs>
|
||||||
<spacer width="100%" height="2%"/>
|
<spacer width="100%" height="2%"/>
|
||||||
|
</div>
|
||||||
|
<spacer width="2%"/>
|
||||||
|
<icon-button id="continue" icon="gui/icons/green_check.png" text="Continue"/>
|
||||||
|
<spacer width="2%"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>
|
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>
|
||||||
|
@ -1,26 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<stkgui>
|
<stkgui>
|
||||||
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
<div x="1%" y="1%" width="98%" height="90%" layout="vertical-row" >
|
||||||
<header width="80%" height="8%" align="center" text_align="center" I18N="In the kart selection (player setup) screen" text="Choose a Kart"/>
|
<header width="80%" height="8%" align="center" text_align="center" I18N="In the kart selection (player setup) screen" text="Choose a Kart"/>
|
||||||
<spacer width="100%" height="1%"/>
|
<spacer width="100%" height="1%"/>
|
||||||
|
|
||||||
<placeholder id="playerskarts" width="100%" align="center" proportion="5">
|
<placeholder id="playerskarts" width="100%" height="70%" align="center" proportion="5">
|
||||||
<!-- Contents is added programatically -->
|
<!-- Contents is added programatically -->
|
||||||
</placeholder>
|
</placeholder>
|
||||||
|
|
||||||
<spacer height="15" width="25"/>
|
<spacer height="1f"/>
|
||||||
|
<div width="100%" height="30%" layout="horizontal-row" >
|
||||||
<box proportion="2" width="100%" layout="vertical-row" padding="2">
|
<div id="kartlist" width="90%" height="100%" layout="vertical-row" >
|
||||||
<ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center"
|
<box proportion="2" width="100%" layout="vertical-row" padding="2">
|
||||||
child_width="90" child_height="90" max_rows="2"/>
|
<ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center"
|
||||||
</box>
|
child_width="90" child_height="90" max_rows="2"/>
|
||||||
|
</box>
|
||||||
<!-- Groups will be added dynamically at runtime -->
|
<!-- Groups will be added dynamically at runtime -->
|
||||||
<tabs width="98%" x="1%" height="1f" 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="1f" width="98%"></progressbar>
|
</div>
|
||||||
|
<spacer width="2%"/>
|
||||||
|
<icon-button id="continue" proportion="1" icon="gui/icons/green_check.png" text="Continue"/>
|
||||||
|
<spacer width="2%"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<progressbar x="2%" y="93%" id="timer" height="1f" width="96%"></progressbar>
|
||||||
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>
|
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>
|
||||||
|
|
||||||
</stkgui>
|
</stkgui>
|
||||||
|
@ -268,6 +268,28 @@ void KartSelectionScreen::loadedFromFile()
|
|||||||
|
|
||||||
void KartSelectionScreen::beforeAddingWidget()
|
void KartSelectionScreen::beforeAddingWidget()
|
||||||
{
|
{
|
||||||
|
if (useContinueButton())
|
||||||
|
{
|
||||||
|
getWidget("kartlist")->m_properties[GUIEngine::PROP_WIDTH] = "90%";
|
||||||
|
getWidget("continue")->setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getWidget("kartlist")->m_properties[GUIEngine::PROP_WIDTH] = "100%";
|
||||||
|
getWidget("continue")->setVisible(false);
|
||||||
|
}
|
||||||
|
// Remove dispatcher from m_widgets before calculateLayout otherwise a
|
||||||
|
// dummy button is shown in kart screen
|
||||||
|
bool removed_dispatcher = false;
|
||||||
|
if (m_widgets.contains(m_dispatcher))
|
||||||
|
{
|
||||||
|
m_widgets.remove(m_dispatcher);
|
||||||
|
removed_dispatcher = true;
|
||||||
|
}
|
||||||
|
calculateLayout();
|
||||||
|
if (removed_dispatcher)
|
||||||
|
m_widgets.push_back(m_dispatcher);
|
||||||
|
|
||||||
// Dynamically add tabs
|
// Dynamically add tabs
|
||||||
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
|
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
|
||||||
assert( tabs != NULL );
|
assert( tabs != NULL );
|
||||||
@ -1098,7 +1120,14 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
|||||||
}
|
}
|
||||||
else if (name == "karts")
|
else if (name == "karts")
|
||||||
{
|
{
|
||||||
if (m_kart_widgets.size() > unsigned(player_id))
|
if (!useContinueButton() &&
|
||||||
|
m_kart_widgets.size() > unsigned(player_id))
|
||||||
|
playerConfirm(player_id);
|
||||||
|
}
|
||||||
|
else if (name == "continue")
|
||||||
|
{
|
||||||
|
if (useContinueButton() &&
|
||||||
|
m_kart_widgets.size() > unsigned(player_id))
|
||||||
playerConfirm(player_id);
|
playerConfirm(player_id);
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
@ -1551,6 +1580,15 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
bool KartSelectionScreen::useContinueButton() const
|
||||||
|
{
|
||||||
|
if (m_multiplayer)
|
||||||
|
return false;
|
||||||
|
bool multitouch_enabled = (UserConfigParams::m_multitouch_active == 1 &&
|
||||||
|
irr_driver->getDevice()->supportsTouchDevice()) ||
|
||||||
|
UserConfigParams::m_multitouch_active > 1;
|
||||||
|
return multitouch_enabled;
|
||||||
|
} // useContinueButton
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -131,6 +131,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
PtrVector<const KartProperties, REF> getUsableKarts(
|
PtrVector<const KartProperties, REF> getUsableKarts(
|
||||||
const std::string& selected_kart_group);
|
const std::string& selected_kart_group);
|
||||||
|
bool useContinueButton() const;
|
||||||
public:
|
public:
|
||||||
/** Returns the current instance */
|
/** Returns the current instance */
|
||||||
static KartSelectionScreen* getRunningInstance();
|
static KartSelectionScreen* getRunningInstance();
|
||||||
|
@ -32,12 +32,18 @@
|
|||||||
|
|
||||||
using namespace GUIEngine;
|
using namespace GUIEngine;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void NetworkKartSelectionScreen::beforeAddingWidget()
|
||||||
|
{
|
||||||
|
m_multiplayer = NetworkConfig::get()->getNetworkPlayers().size() != 1;
|
||||||
|
KartSelectionScreen::beforeAddingWidget();
|
||||||
|
} // beforeAddingWidget
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void NetworkKartSelectionScreen::init()
|
void NetworkKartSelectionScreen::init()
|
||||||
{
|
{
|
||||||
assert(!NetworkConfig::get()->isAddingNetworkPlayers());
|
assert(!NetworkConfig::get()->isAddingNetworkPlayers());
|
||||||
m_all_players_done = false;
|
m_all_players_done = false;
|
||||||
m_multiplayer = NetworkConfig::get()->getNetworkPlayers().size() != 1;
|
|
||||||
KartSelectionScreen::init();
|
KartSelectionScreen::init();
|
||||||
|
|
||||||
m_timer = getWidget<GUIEngine::ProgressBarWidget>("timer");
|
m_timer = getWidget<GUIEngine::ProgressBarWidget>("timer");
|
||||||
|
@ -64,6 +64,8 @@ private:
|
|||||||
{ return m_available_karts.find(ident) == m_available_karts.end(); }
|
{ return m_available_karts.find(ident) == m_available_karts.end(); }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void updateProgressBarText();
|
void updateProgressBarText();
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void beforeAddingWidget() OVERRIDE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** \brief Implement per-frame callback. */
|
/** \brief Implement per-frame callback. */
|
||||||
|
Loading…
Reference in New Issue
Block a user