+
diff --git a/src/gui/state_manager.cpp b/src/gui/state_manager.cpp
index 9961cc4f4..ab1573b78 100644
--- a/src/gui/state_manager.cpp
+++ b/src/gui/state_manager.cpp
@@ -7,6 +7,7 @@
#include "gui/widget.hpp"
#include "gui/screen.hpp"
#include "input/input_manager.hpp"
+#include "input/device_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "race_manager.hpp"
#include "network/network_manager.hpp"
@@ -326,7 +327,33 @@ namespace StateManager
res->updateItemDisplay();
}
}
+ else if(screen_name == "options_input.stkgui")
+ {
+ GUIEngine::RibbonGridWidget* devices = dynamic_cast
+ (GUIEngine::getCurrentScreen()->getWidget("devices"));
+ assert( devices != NULL );
+
+ static bool devices_inited = false;
+ if(!devices_inited)
+ {
+ devices->addItem("Keyboard","keyboard","gui/keyboard.png");
+
+ const int gamepad_count = input_manager->getDeviceList()->getGamePadAmount();
+
+ for(int i=0; igetDeviceList()->getGamePad(i)->m_name;
+ char internal_name[32];
+ sprintf(internal_name, "gamepad%i", i);
+ devices->addItem(name,internal_name,"gui/gamepad.png");
+ }
+
+ devices_inited = true;
+ }
+ devices->updateItemDisplay();
+ }
} // end init
+
// -- options
else if(name == "options_choice")
{
diff --git a/src/input/device_manager.hpp b/src/input/device_manager.hpp
index 09cbccf5c..19de17f5c 100644
--- a/src/input/device_manager.hpp
+++ b/src/input/device_manager.hpp
@@ -20,6 +20,9 @@ public:
void add(KeyboardDevice* d);
void add(GamePadDevice* d);
+ int getGamePadAmount() const{ return m_gamepad_amount; }
+ GamePadDevice* getGamePad(const int i) { return m_gamepads.get(i); }
+
/** Given some input, finds to which device it belongs and, using the corresponding device object,
maps this input to the corresponding player and game action. returns false if player/action could not be set */
bool mapInputToPlayerAndAction( Input::InputType type, int id0, int id1, int id2, int value,
diff --git a/src/input/input_manager.hpp b/src/input/input_manager.hpp
index c2e380041..0e7cd2fd5 100644
--- a/src/input/input_manager.hpp
+++ b/src/input/input_manager.hpp
@@ -79,6 +79,8 @@ public:
//void input();
void input(const irr::SEvent& event);
+ DeviceManager* getDeviceList() { return m_device_manager; }
+
void setMode(InputDriverMode);
bool isInMode(InputDriverMode);