From b08c2045d02653fa68306f9f19097f9c7a9f4b32 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 31 Mar 2009 16:01:42 +0000 Subject: [PATCH] added default bindings for gamepad buttons + other minor fixes git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3328 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/gui/screen_loader.cpp | 1 - src/gui/widget.cpp | 2 +- src/input/input_device.cpp | 51 ++++++++++++++++++++++++-------------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/gui/screen_loader.cpp b/src/gui/screen_loader.cpp index 91007d944..ceaf56c8e 100644 --- a/src/gui/screen_loader.cpp +++ b/src/gui/screen_loader.cpp @@ -101,7 +101,6 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector& append_t { type = WTYPE_MODEL_VIEW; append_to.push_back(new ModelViewWidget()); - std::cout << "creating a ModelViewWidget\n"; } else { diff --git a/src/gui/widget.cpp b/src/gui/widget.cpp index 4b425832a..ded728581 100644 --- a/src/gui/widget.cpp +++ b/src/gui/widget.cpp @@ -956,7 +956,7 @@ RibbonWidget* RibbonGridWidget::getSelectedRibbon() const #if 0 #pragma mark - -#pragma mark Ribbon Grid Widget +#pragma mark Model View Widget #endif // ----------------------------------------------------------------------------- diff --git a/src/input/input_device.cpp b/src/input/input_device.cpp index 45dca063c..18a380b93 100644 --- a/src/input/input_device.cpp +++ b/src/input/input_device.cpp @@ -84,6 +84,12 @@ bool InputDevice::deserializeAction(irr::io::IrrXMLReader* xml) return true; } + +#if 0 +#pragma mark - +#pragma mark Keyboard +#endif + // ----------------------------------------------------------------------------- KeyboardDevice::KeyboardDevice() { @@ -137,6 +143,13 @@ bool KeyboardDevice::hasBinding(const int key_id, PlayerAction* action /* out */ return false; } // ----------------------------------------------------------------------------- + + +#if 0 +#pragma mark - +#pragma mark gamepad +#endif + /** * Creates a GamePade device from a config file. Note that this device will not yet be ready to be used, * it must first be detected to be connected by SDL (hence m_sdlJoystick is NULL) @@ -191,16 +204,23 @@ void GamePadDevice::open(const int sdl_id) // ----------------------------------------------------------------------------- void GamePadDevice::loadDefaults() { - /* - TODO - default bindings for joystic buttons - m_bindings[PA_NITRO] - m_bindings[PA_DRIFT] - m_bindings[PA_RESCUE] - m_bindings[PA_FIRE] - m_bindings[PA_LOOK_BACK] - */ - // m_bindings[PA_NITRO].type = Input::IT_STICKBUTTON; + // buttons + m_bindings[PA_FIRE].type = Input::IT_STICKBUTTON; + m_bindings[PA_FIRE].id = 0; + m_bindings[PA_NITRO].type = Input::IT_STICKBUTTON; + m_bindings[PA_NITRO].id = 1; + + m_bindings[PA_DRIFT].type = Input::IT_STICKBUTTON; + m_bindings[PA_DRIFT].id = 2; + + m_bindings[PA_RESCUE].type = Input::IT_STICKBUTTON; + m_bindings[PA_RESCUE].id = 3; + + m_bindings[PA_LOOK_BACK].type = Input::IT_STICKBUTTON; + m_bindings[PA_LOOK_BACK].id = 4; + + // axes m_bindings[PA_ACCEL].type = Input::IT_STICKMOTION; m_bindings[PA_ACCEL].id = 1; m_bindings[PA_ACCEL].dir = Input::AD_NEGATIVE; @@ -219,23 +239,16 @@ void GamePadDevice::loadDefaults() /* - set(GA_CURSOR_UP, - Input(Input::IT_STICKMOTION, 0, 1, Input::AD_NEGATIVE)); - set(GA_CURSOR_DOWN, - Input(Input::IT_STICKMOTION, 0, 1, Input::AD_POSITIVE)); - set(GA_CURSOR_LEFT, - Input(Input::IT_STICKMOTION, 0, 0, Input::AD_NEGATIVE)); - set(GA_CURSOR_RIGHT, - Input(Input::IT_STICKMOTION, 0, 0, Input::AD_POSITIVE)); + TODO - mappings for clear/enter/leave ? set(GA_CLEAR_MAPPING, Input(Input::IT_STICKBUTTON, 0, 2)); + set(GA_ENTER, Input(Input::IT_STICKBUTTON, 0, 0), + set(GA_LEAVE, Input(Input::IT_STICKBUTTON, 0, 1), - - Input::IT_KEYBOARD */ } // -----------------------------------------------------------------------------