the input config screen now contains some stuff... ugly and will need some serious thinking, but going along

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3439 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-04-26 01:31:56 +00:00
parent 505f19d267
commit a15c23d878
6 changed files with 53 additions and 18 deletions

BIN
data/gui/gamepad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
data/gui/keyboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -8,66 +8,69 @@
<icon-button id="controls" width="128" height="128" icon="gui/options_input.png" text="Controls"/>
</ribbon>
<spacer proportion="1" width="10" proportion="1"/>
<spacer height="15" width="10" />
<div width="75%" height="40" layout="horizontal-row" >
<scrollable_ribbon id="devices" proportion="3" text="all" width="100%" square_items="false" align="center" child_width="256" child_height="128" />
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Accelerate"/>
<spacer width="20" height="100%" />
<button id="binding_up" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Brake"/>
<spacer width="20" height="100%" />
<button id="binding_down" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Left"/>
<spacer width="20" height="100%" />
<button id="binding_left" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Right"/>
<spacer width="20" height="100%" />
<button id="binding_right" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Fire"/>
<spacer width="20" height="100%" />
<button id="binding_fire" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Nitro"/>
<spacer width="20" height="100%" />
<button id="binding_nitro" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Sharp Turn"/>
<spacer width="20" height="100%" />
<button id="binding_drift" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Rescue"/>
<spacer width="20" height="100%" />
<button id="binding_rescue" proportion="1" height="100%" text="[none]"/>
</div>
<spacer height="15" width="10" proportion="1"/>
<spacer height="5" width="10"/>
<div width="75%" height="40" layout="horizontal-row" >
<div width="75%" proportion="1" layout="horizontal-row" >
<label proportion="2" height="100%" text="Look Back"/>
<spacer width="20" height="100%" />
<button id="binding_look_back" proportion="1" height="100%" text="[none]"/>

View File

@ -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::RibbonGridWidget*>
(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; i<gamepad_count; i++)
{
std::string name = input_manager->getDeviceList()->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")
{

View File

@ -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,

View File

@ -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);