Fixed input bug that occurred when going back in menus
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4354 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
75d7e0afd1
commit
2caccb8c6e
@ -165,7 +165,6 @@ void AbstractStateManager::popMenu()
|
||||
{
|
||||
m_game_mode = MENU;
|
||||
switchToScreen(m_menu_stack[m_menu_stack.size()-1].c_str());
|
||||
input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); // No assign mode on menus by default
|
||||
getCurrentScreen()->init();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
|
||||
#define INPUT_MODE_DEBUG 0
|
||||
|
||||
DeviceManager::DeviceManager()
|
||||
{
|
||||
m_latest_used_device = NULL;
|
||||
@ -89,6 +91,12 @@ void DeviceManager::setAssignMode(const PlayerAssignMode assignMode)
|
||||
{
|
||||
m_assign_mode = assignMode;
|
||||
|
||||
#if INPUT_MODE_DEBUG
|
||||
if (assignMode == NO_ASSIGN) std::cout << "====== DeviceManager::setAssignMode(NO_ASSIGN) ======\n";
|
||||
if (assignMode == ASSIGN) std::cout << "====== DeviceManager::setAssignMode(ASSIGN) ======\n";
|
||||
if (assignMode == DETECT_NEW) std::cout << "====== DeviceManager::setAssignMode(DETECT_NEW) ======\n";
|
||||
#endif
|
||||
|
||||
// when going back to no-assign mode, do some cleanup
|
||||
if (assignMode == NO_ASSIGN)
|
||||
{
|
||||
@ -262,7 +270,7 @@ InputDevice* DeviceManager::getLatestUsedDevice()
|
||||
|
||||
if (m_latest_used_device == NULL)
|
||||
{
|
||||
std::cout<< "========== No latest device, returning keyboard ==========\n";
|
||||
//std::cout<< "========== No latest device, returning keyboard ==========\n";
|
||||
return m_keyboards.get(0); // FIXME: is this right?
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,8 @@ using GUIEngine::EventPropagation;
|
||||
using GUIEngine::EVENT_LET;
|
||||
using GUIEngine::EVENT_BLOCK;
|
||||
|
||||
#define INPUT_MODE_DEBUG 0
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Initialise input
|
||||
*/
|
||||
@ -397,6 +399,9 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
|
||||
//-----------------------------------------------------------------------------
|
||||
void InputManager::setMasterPlayerOnly(bool enabled)
|
||||
{
|
||||
#if INPUT_MODE_DEBUG
|
||||
std::cout << "====== InputManager::setMasterPlayerOnly(" << enabled << ") ======\n";
|
||||
#endif
|
||||
m_master_player_only = enabled;
|
||||
}
|
||||
/** Returns whether only the master player should be allowed to perform changes in menus */
|
||||
@ -616,6 +621,9 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
switch (new_mode)
|
||||
{
|
||||
case MENU:
|
||||
#if INPUT_MODE_DEBUG
|
||||
std::cout << "====== InputManager::setMode(MENU) ======\n";
|
||||
#endif
|
||||
switch (m_mode)
|
||||
{
|
||||
case INGAME:
|
||||
@ -673,6 +681,9 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
|
||||
break;
|
||||
case INGAME:
|
||||
#if INPUT_MODE_DEBUG
|
||||
std::cout << "====== InputManager::setMode(INGAME) ======\n";
|
||||
#endif
|
||||
// We must be in menu mode now in order to switch.
|
||||
assert (m_mode == MENU);
|
||||
|
||||
@ -689,6 +700,9 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
break;
|
||||
case INPUT_SENSE_KEYBOARD:
|
||||
case INPUT_SENSE_GAMEPAD:
|
||||
#if INPUT_MODE_DEBUG
|
||||
std::cout << "====== InputManager::setMode(INPUT_SENSE_*) ======\n";
|
||||
#endif
|
||||
// We must be in menu mode now in order to switch.
|
||||
assert (m_mode == MENU);
|
||||
|
||||
@ -705,6 +719,9 @@ void InputManager::setMode(InputDriverMode new_mode)
|
||||
|
||||
break;
|
||||
case LOWLEVEL:
|
||||
#if INPUT_MODE_DEBUG
|
||||
std::cout << "====== InputManager::setMode(LOWLEVEL) ======\n";
|
||||
#endif
|
||||
// We must be in menu mode now in order to switch.
|
||||
assert (m_mode == MENU);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user