Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1659 for code/branches/gui


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.

Location:
code/branches/gui
Files:
5 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}
  • code/branches/gui/src/core/input/InputManager.h

    r1656 r1659  
    9292        enum InputManagerState
    9393        {
    94             Uninitialised    = 0,
    95             Ready            = 1,
    96             Ticking          = 2,
    97             Calibrating      = 4,
    98             ReloadRequest    = 8,
    99             JoyStickSupport  = 16 // used with ReloadRequest to store a bool
     94            Uninitialised    = 0x00,
     95            OISReady         = 0x01,
     96            InternalsReady   = 0x02,
     97            Ticking          = 0x04,
     98            Calibrating      = 0x08,
     99            ReloadRequest    = 0x10,
     100            JoyStickSupport  = 0x20 // used with ReloadRequest to store a bool
    100101        };
    101102
     
    139140        static void keyBind(const std::string& command);
    140141        static void calibrate();
     142        static void reload(bool joyStickSupport = true);
    141143
    142144    private: // functions
  • code/branches/gui/src/core/input/SimpleInputState.cc

    r1653 r1659  
    5555        joyStickHandler_.resize(n);
    5656
    57         if (oldSize > n)
     57        if (n > oldSize)
    5858        {
    5959            // we have to add the handler in joyStickHandlerAll_ to the joyStickHandler_[>n]
  • code/branches/gui/src/orxonox/gui/GUIManager.cc

    r1653 r1659  
    3737
    3838#include <OgreRenderWindow.h>
    39 #include <OgreCEGUIRenderer.h>
    4039#include <OgreRoot.h>
    4140#include <CEGUI.h>
     
    4948#include "tolua/tolua_bind.h"
    5049#include "GraphicsEngine.h"
     50#include "OgreCEGUIRenderer.h"
    5151
    5252extern "C" {
  • code/branches/gui/visual_studio/base_properties.vsprops

    r1642 r1659  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 AdditionalIncludeDirectories="&quot;$(RootDir)&quot;;&quot;$(RootDir)src&quot;;&quot;$(RootDir)src\orxonox&quot;;&quot;$(RootDir)src\tolua&quot;;&quot;$(RootDir)src\ois&quot;;&quot;$(LibDir)ogre-1.4.8\OgreMain\include&quot;;&quot;$(LibDir)boost-1.35.0&quot;;&quot;$(LibDir)cegui-0.6.1\include&quot;;&quot;$(LibDir)cegui-0.6.1\ScriptingModules\CEGUILua\LuaScriptModule\include&quot;;&quot;$(LibDir)enet-1.2\include&quot;;&quot;$(LibDir)libogg-1.1.3\include&quot;;&quot;$(LibDir)libvorbis-1.2.0\include&quot;;&quot;$(LibDir)lua-5.1.3\src&quot;;&quot;$(LibDir)openal-1.1\include&quot;;&quot;$(LibDir)openal-1.1\alut\include&quot;;&quot;$(LibDir)tcl-8.5.\generic&quot;;&quot;$(LibDir)zlib-1.2.3&quot;;&quot;$(LibDir)ogre-1.4.9\Samples\Common\CEGUIRenderer\include&quot;"
     10                AdditionalIncludeDirectories="&quot;$(RootDir)&quot;;&quot;$(RootDir)src&quot;;&quot;$(RootDir)src\orxonox&quot;;&quot;$(RootDir)src\tolua&quot;;&quot;$(RootDir)src\ois&quot;;&quot;$(LibDir)ogre-1.4.9\OgreMain\include&quot;;&quot;$(LibDir)boost-1.35.0&quot;;&quot;$(LibDir)cegui-0.6.1\include&quot;;&quot;$(LibDir)cegui-0.6.1\ScriptingModules\CEGUILua\LuaScriptModule\include&quot;;&quot;$(LibDir)enet-1.2\include&quot;;&quot;$(LibDir)libogg-1.1.3\include&quot;;&quot;$(LibDir)libvorbis-1.2.0\include&quot;;&quot;$(LibDir)lua-5.1.3\src&quot;;&quot;$(LibDir)openal-1.1\include&quot;;&quot;$(LibDir)openal-1.1\alut\include&quot;;&quot;$(LibDir)tcl-8.5.\generic&quot;;&quot;$(LibDir)zlib-1.2.3&quot;"
    1111                PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK;OIS_DYNAMIC_LIB; ZLIB_WINAPI"
    1212                WarningLevel="3"
Note: See TracChangeset for help on using the changeset viewer.