Still tweaking kart selection menu input & menu input in general.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3844 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f3cab7c2b3
commit
3c7e489698
@ -145,7 +145,7 @@ void AbstractStateManager::popMenu()
|
||||
|
||||
std::cout << "-- switching to screen " << m_menu_stack[m_menu_stack.size()-1].c_str() << std::endl;
|
||||
switchToScreen(m_menu_stack[m_menu_stack.size()-1].c_str());
|
||||
|
||||
input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); // No assign mode on menus by default
|
||||
eventCallback(NULL, g_init_event);
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,6 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
|
||||
bool action_found = m_device_manager->translateInput( type, deviceID, btnID, axisDirection,
|
||||
value, programaticallyGenerated, &player, &action);
|
||||
|
||||
if (action_found && action == PA_FIRST) return; // input handled internally by the device manager
|
||||
|
||||
// in menus, some keyboard keys are standard (before each player selected his device)
|
||||
// FIXME: should enter always work to accept for a player using keyboard?
|
||||
if(!StateManager::get()->isGameState() && type == Input::IT_KEYBOARD && m_mode == MENU &&
|
||||
@ -287,18 +285,30 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
|
||||
return; // we're done here
|
||||
}
|
||||
|
||||
// New player is joining
|
||||
else if ((player == NULL) && (action == PA_FIRE))
|
||||
{
|
||||
InputDevice *device = NULL;
|
||||
if (type == Input::IT_KEYBOARD)
|
||||
device = m_device_manager->getKeyboard(0);
|
||||
else if (type == Input::IT_STICKBUTTON || type == Input::IT_STICKMOTION)
|
||||
device = m_device_manager->getGamePadFromIrrID(deviceID);
|
||||
/* The way this is currently structured, any time an event is
|
||||
received from an input device that is not associated with a
|
||||
player and the device manager is in DETECT_NEW mode, the event
|
||||
is ignored, unless it is a PA_FIRE event (a player is joining)
|
||||
|
||||
if (device != NULL)
|
||||
KartSelectionScreen::firePressedOnNewDevice( device );
|
||||
return; // we're done here
|
||||
perhaps it will be good to let unassigned devices back out
|
||||
of the kart selection menu?
|
||||
*/
|
||||
|
||||
else if (player == NULL)
|
||||
{
|
||||
// New player is joining
|
||||
if (action == PA_FIRE)
|
||||
{
|
||||
InputDevice *device = NULL;
|
||||
if (type == Input::IT_KEYBOARD)
|
||||
device = m_device_manager->getKeyboard(0);
|
||||
else if (type == Input::IT_STICKBUTTON || type == Input::IT_STICKMOTION)
|
||||
device = m_device_manager->getGamePadFromIrrID(deviceID);
|
||||
|
||||
if (device != NULL)
|
||||
KartSelectionScreen::firePressedOnNewDevice( device );
|
||||
}
|
||||
return; // we're done here, ignore devices that aren't associated with players
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,6 +410,13 @@ bool firePressedOnNewDevice(InputDevice* device)
|
||||
{
|
||||
std::cout << "===== firePressedOnNewDevice =====\n";
|
||||
|
||||
RibbonGridWidget* w = getCurrentScreen()->getWidget<RibbonGridWidget>("karts");
|
||||
if (w == NULL )
|
||||
{
|
||||
std::cout << "firePressedOnNewDevice() called outside of kart selection screen.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if(device == NULL)
|
||||
{
|
||||
std::cout << "I don't know which device was pressed :'(\n";
|
||||
@ -566,7 +573,11 @@ void menuEventKarts(Widget* widget, const std::string& name)
|
||||
}
|
||||
else if(name == "init")
|
||||
{
|
||||
//g_player_karts.clearWithoutDeleting();
|
||||
g_player_karts.clearWithoutDeleting();
|
||||
|
||||
// Always switch to detect_new when the kart selection screen is active??
|
||||
//input_manager->getDeviceList()->setAssignMode(DETECT_NEW);
|
||||
|
||||
g_player_karts.clearAndDeleteAll();
|
||||
|
||||
RibbonGridWidget* w = getCurrentScreen()->getWidget<RibbonGridWidget>("karts");
|
||||
|
@ -105,6 +105,7 @@ void StateManager::menuEventMain(Widget* widget, const std::string& name)
|
||||
|
||||
if(selection == "new")
|
||||
{
|
||||
resetActivePlayers();
|
||||
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
|
||||
KartSelectionScreen::setPlayer0Device(device);
|
||||
pushMenu("karts.stkgui");
|
||||
|
Loading…
Reference in New Issue
Block a user