Draw a touch steering button that allows to run challenges.

It was broken because the fire button uses now the icon of collected weapon, so that it's not displayed at all when there is no weapon.
This commit is contained in:
Deve 2017-02-22 21:43:36 +01:00
parent db4d11a0c5
commit 0767abe2bc
3 changed files with 18 additions and 3 deletions

View File

@ -41,6 +41,7 @@ RaceGUIMultitouch::RaceGUIMultitouch(RaceGUIBase* race_gui)
{
m_race_gui = race_gui;
m_minimap_bottom = 0;
m_gui_action = false;
m_directionnal_wheel_tex = NULL;
m_pause_tex = NULL;
m_nitro_tex = NULL;
@ -147,6 +148,7 @@ void RaceGUIMultitouch::initMultitouchSteering()
"android/blur_bg_button.png");
m_bg_button_focus_tex = irr_driver->getTexture(FileManager::GUI,
"android/blur_bg_button_focus.png");
m_gui_action_tex = irr_driver->getTexture(FileManager::GUI,"challenge.png");
} // initMultitouchSteering
@ -209,8 +211,12 @@ void RaceGUIMultitouch::drawMultitouchSteering(const AbstractKart* kart,
case MultitouchButtonType::BUTTON_FIRE:
{
const Powerup* powerup = kart->getPowerup();
if (powerup->getType() != PowerupManager::POWERUP_NOTHING &&
!kart->hasFinishedRace())
if (m_gui_action == true)
{
btn_texture = m_gui_action_tex;
}
else if (powerup->getType() != PowerupManager::POWERUP_NOTHING
&& !kart->hasFinishedRace())
{
btn_texture = powerup->getIcon()->getTexture();
}
@ -271,7 +277,8 @@ void RaceGUIMultitouch::drawMultitouchSteering(const AbstractKart* kart,
core::vector2df(scale, scale));
}
else if (button->type == MultitouchButtonType::BUTTON_FIRE &&
kart->getPowerup()->getNum() > 1)
kart->getPowerup()->getNum() > 1 &&
m_gui_action == false)
{
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
core::rect<s32> pos((int)(button->x),

View File

@ -35,6 +35,7 @@ private:
RaceGUIBase* m_race_gui;
MultitouchDevice* m_device;
bool m_gui_action;
unsigned int m_minimap_bottom;
video::ITexture* m_directionnal_wheel_tex;
@ -46,6 +47,7 @@ private:
video::ITexture* m_drift_tex;
video::ITexture* m_bg_button_tex;
video::ITexture* m_bg_button_focus_tex;
video::ITexture* m_gui_action_tex;
void initMultitouchSteering();
void closeMultitouchSteering();
@ -59,6 +61,7 @@ public:
const core::vector2df &scaling);
unsigned int getMinimapBottom() {return m_minimap_bottom;}
void setGuiAction(bool enabled = true) {m_gui_action = enabled;}
}; // RaceGUIMultitouch

View File

@ -590,6 +590,11 @@ void RaceGUIOverworld::drawGlobalMiniMap()
true, true /* vcenter */, NULL);
}
}
if (m_multitouch_gui != NULL)
{
m_multitouch_gui->setGuiAction(m_close_to_a_challenge);
}
#endif // SERVER_ONLY
} // drawGlobalMiniMap