Another major update to the input configuration screen. There are now separate configurable keys for menu navigations. Conflictm detection was not implemented back yet; multiplayer gameplay seems broken too. To be continued

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5371 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-05-03 23:37:38 +00:00
parent 54b112dae6
commit 16e3988ddd
9 changed files with 297 additions and 209 deletions

View File

@ -18,8 +18,9 @@
<spacer height="6" width="10"/> <spacer height="6" width="10"/>
<label id="title" width="100%" text_align="center" text="[none]" /> <label id="title" width="100%" text_align="center" text="[none]" />
<spacer height="6" width="10"/> <spacer height="16" width="10"/>
<!--
<div width="85%" proportion="1" layout="horizontal-row" align="center"> <div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Accelerate" text_align="right"/> <label proportion="2" height="100%" I18N="Key binding" text="Accelerate" text_align="right"/>
<spacer proportion="1" height="100%" /> <spacer proportion="1" height="100%" />
@ -100,8 +101,68 @@
I18N="Unbound key binding" text="[none]"/> I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" /> <spacer proportion="1" height="100%" />
</div> </div>
<spacer height="5" width="10"/>
<spacer width="50" height="10" /> <label id="subtitle" width="100%" text="Menu Keys" />
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Left" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_left" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
<spacer height="5" width="10"/>
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Right" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_right" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
<spacer height="5" width="10"/>
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Up" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_up" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
<spacer height="5" width="10"/>
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Down" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_down" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
<spacer height="5" width="10"/>
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Select" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_select" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
<spacer height="5" width="10"/>
<div width="85%" proportion="1" layout="horizontal-row" align="center">
<label proportion="2" height="100%" I18N="Key binding" text="Cancel" text_align="right"/>
<spacer proportion="1" height="100%" />
<button id="menu_cancel" proportion="3" height="100%"
I18N="Unbound key binding" text="[none]"/>
<spacer proportion="1" height="100%" />
</div>
-->
<list id="actions" proportion="5" width="75%" align="center"/>
<spacer width="50" height="20" />
<button id="back_to_device_list" I18N="In the input configuration screen" text="Back to device list"/> <button id="back_to_device_list" I18N="In the input configuration screen" text="Back to device list"/>

View File

@ -585,6 +585,13 @@ void ScalableFont::draw(const core::stringw& text, const core::rect<s32>& positi
{ {
wchar_t c = text[i]; wchar_t c = text[i];
//hack: one tab character is supported, it moves the cursor to the middle of the area
if (c == L'\t')
{
offset.X = position.UpperLeftCorner.X + position.getWidth()/2;
continue;
}
bool lineBreak=false; bool lineBreak=false;
if (c == L'\r') // Windows breaks if (c == L'\r') // Windows breaks
{ {

View File

@ -155,6 +155,7 @@ namespace GUIEngine
{ {
fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s' cannot be casted to " fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s' cannot be casted to "
"requested type '%s'!\n", name, typeid(*out).name(), typeid(T).name()); "requested type '%s'!\n", name, typeid(*out).name(), typeid(T).name());
abort();
} }
return outCasted; return outCasted;
} }

View File

@ -87,43 +87,51 @@ void ListWidget::clear()
assert(list != NULL); assert(list != NULL);
list->clear(); list->clear();
m_internal_names.clear(); m_items.clear();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void ListWidget::addItem(const stringw item, const int icon) void ListWidget::addItem(const std::string internalName, const irr::core::stringw name, const int icon)
{ {
ListItem newItem;
newItem.m_label = name;
newItem.m_internal_name = internalName;
IGUIListBox* list = getIrrlichtElement<IGUIListBox>(); IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
assert(list != NULL); assert(list != NULL);
if (m_use_icons && icon != -1) if (m_use_icons && icon != -1)
{ {
u32 newItem = list->addItem( item.c_str(), icon ); u32 itemID = list->addItem( name.c_str(), icon );
list->setItemOverrideColor( newItem, gui::EGUI_LBC_ICON, video::SColor(255,255,255,255) ); list->setItemOverrideColor( itemID, gui::EGUI_LBC_ICON, video::SColor(255,255,255,255) );
list->setItemOverrideColor( newItem, gui::EGUI_LBC_ICON_HIGHLIGHT, video::SColor(255,255,255,255) ); list->setItemOverrideColor( itemID, gui::EGUI_LBC_ICON_HIGHLIGHT, video::SColor(255,255,255,255) );
newItem.m_current_id = itemID;
} }
else else
{ {
list->addItem( item.c_str() ); newItem.m_current_id = list->addItem( name.c_str() );
} }
m_items.push_back(newItem);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void ListWidget::addItem(const std::string internalName, const irr::core::stringw item, const int icon) void ListWidget::renameItem(const int itemID, const irr::core::stringw newName, const int icon)
{ {
m_internal_names[item] = internalName; IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
addItem(item, icon); assert(list != NULL);
m_items[itemID].m_label = newName;
list->setItem(itemID, newName.c_str(), icon);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::string ListWidget::getSelectionInternalName() std::string ListWidget::getSelectionInternalName()
{ {
const IGUIListBox* list = getIrrlichtElement<IGUIListBox>(); return m_items[ getSelectionID() ].m_internal_name;
assert(list != NULL);
return m_internal_names[ list->getListItem( list->getSelected() ) ];
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -176,7 +184,16 @@ void ListWidget::setSelectionID(const int index)
int ListWidget::getItemCount() const int ListWidget::getItemCount() const
{ {
return getIrrlichtElement<IGUIListBox>()->getItemCount(); const int count = getIrrlichtElement<IGUIListBox>()->getItemCount();
assert((int)m_items.size() == count);
return count;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void ListWidget::elementRemoved()
{
Widget::elementRemoved();
m_items.clear();
}

View File

@ -41,9 +41,15 @@ namespace GUIEngine
/** \brief if m_use_icons is true, this will contain the icon bank */ /** \brief if m_use_icons is true, this will contain the icon bank */
irr::gui::STKModifiedSpriteBank* m_icons; irr::gui::STKModifiedSpriteBank* m_icons;
std::map< irr::core::stringw /*label*/, std::string /* internal name */> m_internal_names; struct ListItem
{
std::string m_internal_name;
irr::core::stringw m_label;
int m_current_id;
};
std::vector< ListItem > m_items;
public: public:
ListWidget(); ListWidget();
@ -66,21 +72,14 @@ namespace GUIEngine
// ---- contents management // ---- contents management
/**
* \brief add an item to the list
* \param item name of the item
* \param icon ID of the icon within the icon bank. Only used if an icon bank was passed.
* \precondition may only be called after the widget has been added to the screen with add()
*/
void addItem(const irr::core::stringw item, const int icon=-1);
/** /**
* \brief add an item to the list * \brief add an item to the list
* \param item name of the item * \param name user-visible, potentially translated, name of the item
* \param icon ID of the icon within the icon bank. Only used if an icon bank was passed. * \param icon ID of the icon within the icon bank. Only used if an icon bank was passed.
* \precondition may only be called after the widget has been added to the screen with add() * \precondition may only be called after the widget has been added to the screen with add()
*/ */
void addItem(const std::string internalName, const irr::core::stringw item, const int icon=-1); void addItem(const std::string internalName, const irr::core::stringw name, const int icon=-1);
/** /**
* \brief erases all items in the list * \brief erases all items in the list
@ -114,6 +113,10 @@ namespace GUIEngine
* \precondition may only be called after the widget has been added to the screen with add() * \precondition may only be called after the widget has been added to the screen with add()
*/ */
void setSelectionID(const int index); void setSelectionID(const int index);
void renameItem(const int itemID, const irr::core::stringw newName, const int icon=-1);
virtual void elementRemoved();
}; };
} }

View File

@ -296,11 +296,27 @@ int InputManager::getPlayerKeyboardID() const
*/ */
void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID, int axisDirection, int value) void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID, int axisDirection, int value)
{ {
// Act different in input sensing mode.
if (m_mode == INPUT_SENSE_KEYBOARD ||
m_mode == INPUT_SENSE_GAMEPAD)
{
inputSensing(type, deviceID, btnID, axisDirection, value);
return;
}
StateManager::ActivePlayer* player = NULL; StateManager::ActivePlayer* player = NULL;
PlayerAction action; PlayerAction action;
bool action_found = m_device_manager->translateInput( type, deviceID, btnID, axisDirection, value, bool action_found = m_device_manager->translateInput( type, deviceID, btnID, axisDirection, value,
/*m_mode*/INGAME, &player, &action); m_mode, &player, &action);
// if didn't find a _menu_ action, try finding a corresponding game action as fallback
// (the GUI can handle them too)
if (!action_found && m_mode == MENU)
{
action_found = m_device_manager->translateInput(type, deviceID, btnID, axisDirection, value,
INGAME, &player, &action);
}
// in menus, some keyboard keys are standard (before each player selected his device) // in menus, some keyboard keys are standard (before each player selected his device)
// So if a key could not be mapped to any known binding, fall back to check the defaults. // So if a key could not be mapped to any known binding, fall back to check the defaults.
if (!action_found && StateManager::get()->getGameState() != GUIEngine::GAME && type == Input::IT_KEYBOARD && if (!action_found && StateManager::get()->getGameState() != GUIEngine::GAME && type == Input::IT_KEYBOARD &&
@ -327,14 +343,8 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
} }
} }
// Act different in input sensing mode. // do something with the key if it matches a binding
if (m_mode == INPUT_SENSE_KEYBOARD || if (action_found)
m_mode == INPUT_SENSE_GAMEPAD)
{
inputSensing(type, deviceID, btnID, axisDirection, value);
}
// Otherwise, do something with the key if it matches a binding
else if (action_found)
{ {
// If we're in the kart menu awaiting new players, do special things // If we're in the kart menu awaiting new players, do special things
// when a device presses fire or rescue // when a device presses fire or rescue

View File

@ -49,6 +49,7 @@ DEFINE_SCREEN_SINGLETON( OptionsScreenInput2 );
OptionsScreenInput2::OptionsScreenInput2() : Screen("options_device.stkgui") OptionsScreenInput2::OptionsScreenInput2() : Screen("options_device.stkgui")
{ {
m_config = NULL; m_config = NULL;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -59,175 +60,118 @@ void OptionsScreenInput2::loadedFromFile()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void OptionsScreenInput2::updateInputButtons()
{
assert(m_config != NULL);
// to detect duplicate entries
std::set<core::stringw> existing_bindings;
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_up");
core::stringw binding_name = m_config->getBindingAsString(PA_ACCEL);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_down");
core::stringw binding_name = m_config->getBindingAsString(PA_BRAKE);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_left");
core::stringw binding_name = m_config->getBindingAsString(PA_STEER_LEFT);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_right");
core::stringw binding_name = m_config->getBindingAsString(PA_STEER_RIGHT);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
std::set<core::stringw>::iterator it;
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_fire");
core::stringw binding_name = m_config->getBindingAsString(PA_FIRE);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
//std::cout << "Setting bad badge!!!!\n";
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_nitro");
core::stringw binding_name = m_config->getBindingAsString(PA_NITRO);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_drift");
core::stringw binding_name = m_config->getBindingAsString(PA_DRIFT);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_rescue");
core::stringw binding_name = m_config->getBindingAsString(PA_RESCUE);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
{
ButtonWidget* btn = this->getWidget<ButtonWidget>("binding_look_back");
core::stringw binding_name = m_config->getBindingAsString(PA_LOOK_BACK);
btn->setLabel( binding_name );
// check if another binding already uses this key
if (existing_bindings.find(binding_name) != existing_bindings.end())
{
btn->setBadge(BAD_BADGE);
}
else
{
existing_bindings.insert(binding_name);
btn->resetAllBadges();
}
}
}
// -----------------------------------------------------------------------------
void OptionsScreenInput2::init() void OptionsScreenInput2::init()
{ {
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice"); RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
if (tabBar != NULL) tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER ); if (tabBar != NULL) tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER );
updateInputButtons();
LabelWidget* label = this->getWidget<LabelWidget>("title"); LabelWidget* label = this->getWidget<LabelWidget>("title");
label->setText( m_config->getName().c_str() ); label->setText( m_config->getName().c_str() );
GUIEngine::ListWidget* actions = this->getWidget<GUIEngine::ListWidget>("actions");
assert( actions != NULL );
// ---- create list skeleton (right number of items, right internal names)
// their actualy contents will be adapted as needed after
//I18N: Key binding section
actions->addItem("game_keys_section", _("Game Keys") );
actions->addItem(KartActionStrings[PA_STEER_LEFT], L"" );
actions->addItem(KartActionStrings[PA_STEER_RIGHT], L"" );
actions->addItem(KartActionStrings[PA_ACCEL], L"" );
actions->addItem(KartActionStrings[PA_BRAKE], L"" );
actions->addItem(KartActionStrings[PA_FIRE], L"" );
actions->addItem(KartActionStrings[PA_NITRO], L"" );
actions->addItem(KartActionStrings[PA_DRIFT], L"" );
actions->addItem(KartActionStrings[PA_LOOK_BACK], L"" );
actions->addItem(KartActionStrings[PA_RESCUE], L"" );
//I18N: Key binding section
actions->addItem("menu_keys_section", _("Menu Keys") );
actions->addItem(KartActionStrings[PA_MENU_UP], L"" );
actions->addItem(KartActionStrings[PA_MENU_DOWN], L"" );
actions->addItem(KartActionStrings[PA_MENU_LEFT], L"" );
actions->addItem(KartActionStrings[PA_MENU_RIGHT], L"" );
actions->addItem(KartActionStrings[PA_MENU_SELECT], L"");
actions->addItem(KartActionStrings[PA_MENU_CANCEL], L"" );
updateInputButtons();
}
// -----------------------------------------------------------------------------
irr::core::stringw OptionsScreenInput2::makeLabel(const irr::core::stringw translatedName,
PlayerAction action) const
{
//hack: one tab character is supported by out font object, it moves the cursor to the middle of the area
core::stringw out = irr::core::stringw(" ") + translatedName + L"\t";
out += m_config->getBindingAsString(action);
return out;
}
// -----------------------------------------------------------------------------
void OptionsScreenInput2::updateInputButtons()
{
assert(m_config != NULL);
//TODO: detect duplicates
GUIEngine::ListWidget* actions = this->getWidget<GUIEngine::ListWidget>("actions");
assert( actions != NULL );
// item 0 is a section header
//I18N: Key binding name
actions->renameItem(1, makeLabel( _("Steer Left"), PA_STEER_LEFT) );
//I18N: Key binding name
actions->renameItem(2, makeLabel( _("Steer Right"), PA_STEER_RIGHT) );
//I18N: Key binding name
actions->renameItem(3, makeLabel( _("Accelerate"), PA_ACCEL) );
//I18N: Key binding name
actions->renameItem(4, makeLabel( _("Brake"), PA_BRAKE) );
//I18N: Key binding name
actions->renameItem(5, makeLabel( _("Fire"), PA_FIRE) );
//I18N: Key binding name
actions->renameItem(6, makeLabel( _("Nitro"), PA_NITRO) );
//I18N: Key binding name
actions->renameItem(7, makeLabel( _("Sharp Turn"), PA_DRIFT) );
//I18N: Key binding name
actions->renameItem(8, makeLabel( _("Look Back"), PA_LOOK_BACK) );
//I18N: Key binding name
actions->renameItem(9, makeLabel( _("Rescue"), PA_RESCUE) );
// item 10 is a section header
//I18N: Key binding name
actions->renameItem(11, makeLabel( _("Up"), PA_MENU_UP) );
//I18N: Key binding name
actions->renameItem(12, makeLabel( _("Down"), PA_MENU_DOWN) );
//I18N: Key binding name
actions->renameItem(13, makeLabel( _("Left"), PA_MENU_LEFT) );
//I18N: Key binding name
actions->renameItem(14, makeLabel( _("Right"), PA_MENU_RIGHT) );
//I18N: Key binding name
actions->renameItem(15, makeLabel( _("Select"), PA_MENU_SELECT) );
//I18N: Key binding name
actions->renameItem(16, makeLabel( _("Cancel/Back"), PA_MENU_CANCEL) );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -255,7 +199,7 @@ void OptionsScreenInput2::gotSensedInput(Input* sensedInput)
keyboard->setBinding(binding_to_set, Input::IT_KEYBOARD, sensedInput->btnID, Input::AD_NEUTRAL); keyboard->setBinding(binding_to_set, Input::IT_KEYBOARD, sensedInput->btnID, Input::AD_NEUTRAL);
// refresh display // refresh display
init(); updateInputButtons();
} }
else if (gamepad) else if (gamepad)
{ {
@ -284,7 +228,7 @@ void OptionsScreenInput2::gotSensedInput(Input* sensedInput)
(Input::AxisDirection)sensedInput->axisDirection); (Input::AxisDirection)sensedInput->axisDirection);
// refresh display // refresh display
init(); updateInputButtons();
} }
else else
{ {
@ -294,9 +238,9 @@ void OptionsScreenInput2::gotSensedInput(Input* sensedInput)
ModalDialog::dismiss(); ModalDialog::dismiss();
input_manager->setMode(InputManager::MENU); input_manager->setMode(InputManager::MENU);
// re-select the previous button // re-select the previous button (TODO!)
ButtonWidget* btn = this->getWidget<ButtonWidget>(binding_to_set_button.c_str()); //ButtonWidget* btn = this->getWidget<ButtonWidget>(binding_to_set_button.c_str());
if(btn != NULL) btn->setFocusForPlayer(PLAYER_ID_GAME_MASTER); //if(btn != NULL) btn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
// save new binding to file // save new binding to file
input_manager->getDeviceList()->serialize(); input_manager->getDeviceList()->serialize();
@ -338,6 +282,47 @@ void OptionsScreenInput2::eventCallback(Widget* widget, const std::string& name,
{ {
StateManager::get()->escapePressed(); StateManager::get()->escapePressed();
} }
else if (name == "actions")
{
GUIEngine::ListWidget* actions = this->getWidget<GUIEngine::ListWidget>("actions");
assert( actions != NULL );
// a player action in the list was clicked. find which one
const std::string& clicked = actions->getSelectionInternalName();
for (int n=PA_BEFORE_FIRST+1; n<PA_COUNT; n++)
{
if (KartActionStrings[n] == clicked)
{
// we found which one. show the "press a key" dialog.
if (UserConfigParams::m_verbosity>=5)
{
std::cout << "\n% Entering sensing mode for "
<< m_config->getName().c_str()
<< std::endl;
}
binding_to_set = (PlayerAction)n;
new PressAKeyDialog(0.4f, 0.4f);
if (m_config->getType() == DEVICE_CONFIG_TYPE_KEYBOARD)
{
input_manager->setMode(InputManager::INPUT_SENSE_KEYBOARD);
}
else if (m_config->getType() == DEVICE_CONFIG_TYPE_GAMEPAD)
{
input_manager->setMode(InputManager::INPUT_SENSE_GAMEPAD);
}
else
{
std::cerr << "unknown selection device in options : " << m_config->getName().c_str() << std::endl;
}
break;
}
}
}
//TODO!
/*
else if(name.find("binding_") != std::string::npos) else if(name.find("binding_") != std::string::npos)
{ {
binding_to_set_button = name; binding_to_set_button = name;
@ -406,8 +391,7 @@ void OptionsScreenInput2::eventCallback(Widget* widget, const std::string& name,
{ {
std::cerr << "unknown selection device in options : " << m_config->getName().c_str() << std::endl; std::cerr << "unknown selection device in options : " << m_config->getName().c_str() << std::endl;
} }
}*/
}
} }

View File

@ -43,6 +43,8 @@ class OptionsScreenInput2 : public GUIEngine::Screen, public GUIEngine::ScreenSi
DeviceConfig* m_config; DeviceConfig* m_config;
irr::core::stringw makeLabel(const irr::core::stringw translatedName, PlayerAction action) const;
public: public:
friend class GUIEngine::ScreenSingleton<OptionsScreenInput2>; friend class GUIEngine::ScreenSingleton<OptionsScreenInput2>;

View File

@ -66,7 +66,8 @@ void OptionsScreenPlayers::init()
const int playerAmount = UserConfigParams::m_all_players.size(); const int playerAmount = UserConfigParams::m_all_players.size();
for(int n=0; n<playerAmount; n++) for(int n=0; n<playerAmount; n++)
{ {
players->addItem( UserConfigParams::m_all_players[n].getName() ); players->addItem( UserConfigParams::m_all_players[n].getName(),
UserConfigParams::m_all_players[n].getName() );
} }
} }
@ -91,7 +92,7 @@ bool OptionsScreenPlayers::gotNewPlayerName(const stringw& newName, PlayerProfil
// add new player // add new player
UserConfigParams::m_all_players.push_back( new PlayerProfile(newNameC.c_str()) ); UserConfigParams::m_all_players.push_back( new PlayerProfile(newNameC.c_str()) );
players->addItem( newNameC.c_str() ); players->addItem( newNameC.c_str(), newNameC.c_str() );
} }
else // ---- Rename existing player else // ---- Rename existing player
{ {
@ -102,7 +103,8 @@ bool OptionsScreenPlayers::gotNewPlayerName(const stringw& newName, PlayerProfil
const int playerAmount = UserConfigParams::m_all_players.size(); const int playerAmount = UserConfigParams::m_all_players.size();
for(int n=0; n<playerAmount; n++) for(int n=0; n<playerAmount; n++)
{ {
players->addItem(UserConfigParams::m_all_players[n].getName()); players->addItem(UserConfigParams::m_all_players[n].getName(),
UserConfigParams::m_all_players[n].getName());
} }
} }
@ -123,7 +125,8 @@ void OptionsScreenPlayers::deletePlayer(PlayerProfile* player)
const int playerAmount = UserConfigParams::m_all_players.size(); const int playerAmount = UserConfigParams::m_all_players.size();
for(int n=0; n<playerAmount; n++) for(int n=0; n<playerAmount; n++)
{ {
players->addItem(UserConfigParams::m_all_players[n].getName()); players->addItem(UserConfigParams::m_all_players[n].getName(),
UserConfigParams::m_all_players[n].getName());
} }
} }