Improvements to input actions handling in GUI, implemented selection of other game modes

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3829 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-08-11 00:55:48 +00:00
parent 2a23fa33a8
commit 72c17d391b
12 changed files with 51 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

View File

@ -46,7 +46,8 @@ bool EventHandler::OnEvent (const SEvent &event)
else
{
// FIXME : it's a bit unclean that all input events go trough the gui module
return input_manager->input(event);
const bool blockPropagation = input_manager->input(event);
return blockPropagation;
}
// to shut up a warning. gcc is too stupid too see the code will never get here
@ -146,6 +147,8 @@ bool EventHandler::onWidgetActivated(GUIEngine::Widget* w)
return false;
}
std::cout << "**** widget activated : " << w->m_properties[PROP_ID].c_str() << " ****" << std::endl;
Widget* parent = w->m_event_handler;
if(w->m_event_handler != NULL)
{
@ -349,29 +352,26 @@ void EventHandler::processAction(const int action, const unsigned int value, Inp
break;
case PA_FIRE:
if(type == Input::IT_STICKBUTTON)
if (pressedDown)
{
if (pressedDown)
{
IGUIElement* element = GUIEngine::getGUIEnv()->getFocus();
Widget* w = GUIEngine::getCurrentScreen()->getWidget( element->getID() );
if(w == NULL) break;
onWidgetActivated( w );
}
/*
// simulate a 'enter' key press
irr::SEvent::SKeyInput evt;
evt.PressedDown = pressedDown;
evt.Key = KEY_SPACE; // FIXME : what if keyboard bindings are not set to use this key?
evt.Char = 666; // My magic code to know it's a fake event (FIXME : ugly, but irrlicht doesn't seem to offer better)
irr::SEvent wrapper;
wrapper.KeyInput = evt;
wrapper.EventType = EET_KEY_INPUT_EVENT;
GUIEngine::getDevice()->postEventFromUser(wrapper);
*/
IGUIElement* element = GUIEngine::getGUIEnv()->getFocus();
Widget* w = GUIEngine::getCurrentScreen()->getWidget( element->getID() );
if(w == NULL) break;
onWidgetActivated( w );
}
/*
// simulate a 'enter' key press
irr::SEvent::SKeyInput evt;
evt.PressedDown = pressedDown;
evt.Key = KEY_SPACE; // FIXME : what if keyboard bindings are not set to use this key?
evt.Char = 666; // My magic code to know it's a fake event (FIXME : ugly, but irrlicht doesn't seem to offer better)
irr::SEvent wrapper;
wrapper.KeyInput = evt;
wrapper.EventType = EET_KEY_INPUT_EVENT;
GUIEngine::getDevice()->postEventFromUser(wrapper);
*/
break;
default:
return;

View File

@ -251,6 +251,7 @@
95833240101243ED00C5137E /* player_info_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95833239101243ED00C5137E /* player_info_dialog.cpp */; };
95833241101243ED00C5137E /* press_a_key_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9583323B101243ED00C5137E /* press_a_key_dialog.cpp */; };
95833242101243ED00C5137E /* track_info_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9583323D101243ED00C5137E /* track_info_dialog.cpp */; };
95B5CD14102DE08F00EF2001 /* device_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95B5CD13102DE08F00EF2001 /* device_config.cpp */; };
95CB476C0FF30EF400413BAE /* bezier_curve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CB476B0FF30EF400413BAE /* bezier_curve.cpp */; };
95D1F5F70FC8C3E300FF6968 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D1F5F60FC8C3E300FF6968 /* input.cpp */; };
95D950D20FE473CA002E10AD /* stk_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D950CE0FE473CA002E10AD /* stk_config.cpp */; };
@ -415,6 +416,8 @@
95A1184C0F77FC8800B18B3D /* input_device.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_device.hpp; path = ../../input/input_device.hpp; sourceTree = SOURCE_ROOT; };
95A1187A0F78024E00B18B3D /* device_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = device_manager.cpp; path = ../../input/device_manager.cpp; sourceTree = SOURCE_ROOT; };
95A1187C0F78026D00B18B3D /* device_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = device_manager.hpp; path = ../../input/device_manager.hpp; sourceTree = SOURCE_ROOT; };
95B5CD12102DE08F00EF2001 /* device_config.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = device_config.hpp; path = ../../config/device_config.hpp; sourceTree = SOURCE_ROOT; };
95B5CD13102DE08F00EF2001 /* device_config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = device_config.cpp; path = ../../config/device_config.cpp; sourceTree = SOURCE_ROOT; };
95C2AC270F296540000D3E5D /* music.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = music.hpp; path = ../../audio/music.hpp; sourceTree = SOURCE_ROOT; };
95C2AC280F296540000D3E5D /* music_information.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = music_information.cpp; path = ../../audio/music_information.cpp; sourceTree = SOURCE_ROOT; };
95C2AC290F296540000D3E5D /* music_information.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = music_information.hpp; path = ../../audio/music_information.hpp; sourceTree = SOURCE_ROOT; };
@ -2115,6 +2118,8 @@
95D950CC0FE473CA002E10AD /* config */ = {
isa = PBXGroup;
children = (
95B5CD13102DE08F00EF2001 /* device_config.cpp */,
95B5CD12102DE08F00EF2001 /* device_config.hpp */,
956D36A610095035007FCB95 /* player.cpp */,
95D950CD0FE473CA002E10AD /* player.hpp */,
95D950CE0FE473CA002E10AD /* stk_config.cpp */,
@ -2468,6 +2473,7 @@
95ECA10710124C5000D47C5F /* ribbon_widget.cpp in Sources */,
95ECA10810124C5000D47C5F /* spinner_widget.cpp in Sources */,
95ECA10910124C5000D47C5F /* text_box_widget.cpp in Sources */,
95B5CD14102DE08F00EF2001 /* device_config.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -338,6 +338,7 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
* negative direction. This simplifies input configuration and allows greater
* flexibility (= treat 4 directions as four buttons).
*
* Returns whether to halt the event's propagation here
*/
bool InputManager::input(const SEvent& event)
{
@ -375,7 +376,7 @@ bool InputManager::input(const SEvent& event)
if (gp == NULL)
{
// Prevent null pointer crash
return false;
return true;
}
for(int i=0; i<gp->m_button_count; i++)
@ -455,9 +456,8 @@ bool InputManager::input(const SEvent& event)
*/
}
#endif
// FIXME: to restore the original behaviour (engine returns false in the
// case the input_manager::input is called)
return false;
return getDeviceList()->playerAssignMode() != NO_ASSIGN; // block events in all modes but initial menus
}
//-----------------------------------------------------------------------------

View File

@ -182,12 +182,29 @@ void StateManager::menuEventRaceSetup(Widget* widget, const std::string& name)
}
else if(name == "gamemode")
{
// TODO - detect more game modes
RibbonGridWidget* w = dynamic_cast<RibbonGridWidget*>(widget);
if(w->getSelectionIDString() == "normal")
const std::string selectedMode = w->getSelectionIDString();
if (selectedMode == "normal")
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_QUICK_RACE);
pushMenu("tracks.stkgui");
}
else if (selectedMode == "timetrial")
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
pushMenu("tracks.stkgui");
}
else if (selectedMode == "ftl")
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
pushMenu("tracks.stkgui");
}
else if (selectedMode == "3strikes")
{
// TODO - 3 strikes battle mode selection
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
}
}
else if(name == "aikartamount")
{