Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 14, 2008, 9:41:48 PM (16 years ago)
Author:
rgrieder
Message:

reload feature tested and works under windows, but only with one joy stick. Will have to test it with multiple ones when that is properly supported.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/input/InputManager.cc

    r1656 r1659  
    5959namespace orxonox
    6060{
    61     SetConsoleCommandShortcut(InputManager, keyBind);
    62     SetConsoleCommandShortcut(InputManager, storeKeyStroke);
    63     SetConsoleCommandShortcut(InputManager, calibrate);
     61    SetConsoleCommand(InputManager, keyBind, true);
     62    SetConsoleCommand(InputManager, storeKeyStroke, true);
     63    SetConsoleCommand(InputManager, calibrate, true);
     64    SetConsoleCommand(InputManager, reload, false);
    6465
    6566    std::string InputManager::bindingCommmandString_s = "";
     
    132133    void InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight, bool joyStickSupport)
    133134    {
    134         if (internalState_ == Uninitialised)
    135         {
    136             CCOUT(3) << "Initialising Input System..." << std::endl;
     135        CCOUT(3) << "Initialising Input System..." << std::endl;
     136
     137        if (!(internalState_ & OISReady))
     138        {
    137139            CCOUT(4) << "Initialising OIS components..." << std::endl;
    138140
     
    169171            _clearBuffers();
    170172
     173            // load joy stick calibration
     174            setConfigValues();
     175
     176            internalState_ |= OISReady;
     177
    171178            CCOUT(ORX_DEBUG) << "Initialising OIS components done." << std::endl;
    172 
    173             setConfigValues();
     179        }
     180        else
     181        {
     182            CCOUT(2) << "Warning: OIS compoments already initialised, skipping" << std::endl;
     183        }
     184
     185        if (!(internalState_ & InternalsReady))
     186        {
     187            CCOUT(4) << "Initialising InputStates components..." << std::endl;
    174188
    175189            stateEmpty_ = createInputState<SimpleInputState>("empty", -1);
     
    188202            stateCalibrator_->setKeyHandler(buffer);
    189203
    190             _updateActiveStates();
    191 
    192             internalState_ = Ready;
    193 
    194             CCOUT(3) << "Initialising complete." << std::endl;
    195         }
    196         else
    197         {
    198             CCOUT(2) << "Warning: OIS compoments already initialised, skipping" << std::endl;
    199         }
     204            internalState_ |= InternalsReady;
     205
     206            CCOUT(4) << "Initialising InputStates complete." << std::endl;
     207        }
     208
     209        _updateActiveStates();
     210
     211        CCOUT(3) << "Initialising complete." << std::endl;
    200212    }
    201213
     
    486498
    487499            joySticks_.clear();
     500            _redimensionLists();
    488501        }
    489502        CCOUT(4) << "Joy sticks destroyed." << std::endl;
     
    543556            internalState_ |= ReloadRequest;
    544557            // Misuse of internalState_: We can easily store the joyStickSupport bool.
    545             // use Uninitialised as 0 value in order to use the overloaded |= operator
     558            // use Uninitialised as 0 value in order to make use of the overloaded |= operator
    546559            internalState_ |= joyStickSupport ? JoyStickSupport : Uninitialised;
    547560        }
    548         else if (internalState_ == Ready)
     561        else if (internalState_ & OISReady)
    549562        {
    550563            _reload(joyStickSupport);
     
    571584            int mouseHeight = mouse_->getMouseState().height;
    572585
    573             internalState_ = Uninitialised;
     586            internalState_ &= ~OISReady;
     587
    574588            // destroy the devices
    575589            _destroyKeyboard();
     
    674688        }
    675689
    676         internalState_ &= ~Ready;
     690        internalState_ &= ~Ticking;
    677691    }
    678692
     
    12571271        getInstance().requestEnterState("calibrator");
    12581272    }
     1273
     1274    /**
     1275    @brief
     1276        Reloads the input system
     1277    */
     1278    void InputManager::reload(bool joyStickSupport)
     1279    {
     1280        getInstance().reloadInputSystem(joyStickSupport);
     1281    }
    12591282}
Note: See TracChangeset for help on using the changeset viewer.