Add more spectator camera to mobile stk

This commit is contained in:
Benau 2020-07-17 20:57:27 +08:00
parent 12167aeafb
commit ca42d0826e
2 changed files with 15 additions and 1 deletions

View File

@ -64,6 +64,7 @@ RaceGUIMultitouch::RaceGUIMultitouch(RaceGUIBase* race_gui)
m_gui_action_tex = NULL;
m_up_tex = NULL;
m_down_tex = NULL;
m_screen_tex = NULL;
m_device = input_manager->getDeviceManager()->getMultitouchDevice();
@ -157,6 +158,7 @@ void RaceGUIMultitouch::init()
m_gui_action_tex = irr_driver->getTexture(FileManager::GUI_ICON,"challenge.png");
m_up_tex = irr_driver->getTexture(FileManager::GUI_ICON, "up.png");
m_down_tex = irr_driver->getTexture(FileManager::GUI_ICON, "down.png");
m_screen_tex = irr_driver->getTexture(FileManager::GUI_ICON, "screen_other.png");
#ifndef SERVER_ONLY
if (CVS->isGLSL())
{
@ -310,7 +312,10 @@ void RaceGUIMultitouch::createSpectatorGUI()
m_device->addButton(BUTTON_CUSTOM,
int(margin * 3 + btn_size * 2), int(h - margin - btn_size),
int(btn_size), int(btn_size), onCustomButtonPress);
m_device->addButton(BUTTON_CUSTOM,
int(margin * 4 + btn_size * 3), int(h - margin - btn_size),
int(btn_size), int(btn_size), onCustomButtonPress);
} // createSpectatorGUI
//-----------------------------------------------------------------------------
@ -341,6 +346,10 @@ void RaceGUIMultitouch::onCustomButtonPress(unsigned int button_id,
cl->changeSpectateTarget(PA_LOOK_BACK, Input::MAX_VALUE,
Input::IT_KEYBOARD);
break;
case 4:
cl->changeSpectateTarget(PA_ACCEL, Input::MAX_VALUE,
Input::IT_KEYBOARD);
break;
}
}
@ -496,6 +505,10 @@ void RaceGUIMultitouch::draw(const AbstractKart* kart,
{
btn_texture = m_wing_mirror_tex;
}
else if (button->id == 4)
{
btn_texture = m_screen_tex;
}
break;
default:
break;

View File

@ -55,6 +55,7 @@ private:
video::ITexture* m_gui_action_tex;
video::ITexture* m_up_tex;
video::ITexture* m_down_tex;
video::ITexture* m_screen_tex;
void init();
void createRaceGUI();