Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2009, 5:31:02 PM (15 years ago)
Author:
rgrieder
Message:

Merged all remaining revisions from core4 back to the trunk.

Location:
code/trunk
Files:
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/GraphicsManager.cc

    r3323 r3327  
    6363#include "core/Game.h"
    6464#include "core/GameMode.h"
     65#include "core/WindowEventListener.h"
    6566#include "tools/ParticleInterface.h"
    66 #include "interfaces/WindowEventListener.h"
    6767
    6868// HACK!
     
    7373    using boost::shared_ptr;
    7474
    75     class _OrxonoxExport OgreWindowEventListener : public Ogre::WindowEventListener
    76     {
    77         void windowResized     (Ogre::RenderWindow* rw);
    78         void windowFocusChange (Ogre::RenderWindow* rw);
    79         void windowClosed      (Ogre::RenderWindow* rw);
    80         //void windowMoved       (Ogre::RenderWindow* rw);
     75    class OgreWindowEventListener : public Ogre::WindowEventListener
     76    {
     77    public:
     78        void windowResized     (Ogre::RenderWindow* rw)
     79            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
     80        void windowFocusChange (Ogre::RenderWindow* rw)
     81            { orxonox::WindowEventListener::changeWindowFocus(); }
     82        void windowClosed      (Ogre::RenderWindow* rw)
     83            { orxonox::Game::getInstance().stop(); }
     84        void windowMoved       (Ogre::RenderWindow* rw)
     85            { orxonox::WindowEventListener::moveWindow(); }
    8186    };
    8287
     
    347352
    348353        this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
     354        this->ogreWindowEventListener_->windowResized(renderWindow_);
    349355
    350356        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_);
     
    418424        this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
    419425    }
    420 
    421 
    422     /****** OgreWindowEventListener ******/
    423 
    424     void OgreWindowEventListener::windowResized(Ogre::RenderWindow* rw)
    425     {
    426         for (ObjectList<orxonox::WindowEventListener>::iterator it
    427             = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
    428             it->windowResized(rw->getWidth(), rw->getHeight());
    429     }
    430     void OgreWindowEventListener::windowFocusChange(Ogre::RenderWindow* rw)
    431     {
    432         for (ObjectList<orxonox::WindowEventListener>::iterator it
    433             = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
    434             it->windowFocusChanged();
    435     }
    436     void OgreWindowEventListener::windowClosed(Ogre::RenderWindow* rw)
    437     {
    438         Game::getInstance().stop();
    439     }
    440426}
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r3280 r3327  
    9292    class Level;
    9393    class Scene;
     94    class Tickable;
    9495
    9596    class AddQuest;
  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r3280 r3327  
    3838#include <OgreRenderWindow.h>
    3939
    40 #include "core/ConfigValueIncludes.h"
     40#include "util/Convert.h"
    4141#include "core/Clock.h"
     42#include "core/CommandExecutor.h"
    4243#include "core/ConsoleCommand.h"
    4344#include "core/Core.h"
    44 #include "core/CoreIncludes.h"
    4545#include "core/Game.h"
    4646#include "core/GameMode.h"
    4747#include "core/input/InputManager.h"
    4848#include "core/input/KeyBinder.h"
    49 #include "core/input/SimpleInputState.h"
     49#include "core/input/InputState.h"
    5050#include "core/Loader.h"
    5151#include "core/XMLFile.h"
     
    7070        , debugOverlay_(0)
    7171    {
    72         RegisterRootObject(GSGraphics);
    7372    }
    7473
    7574    GSGraphics::~GSGraphics()
    76     {
    77     }
    78 
    79     /**
    80     @brief
    81         this function does nothing
    82 
    83         Indeed. Here goes nothing.
    84     */
    85     void GSGraphics::setConfigValues()
    8675    {
    8776    }
     
    10695        GameMode::setShowsGraphics(true);
    10796
    108         setConfigValues();
    109 
    11097        // Load OGRE including the render window
    11198        this->graphicsManager_ = new GraphicsManager();
     
    122109
    123110        // Calls the InputManager which sets up the input devices.
    124         inputManager_ = new InputManager();
    125         inputManager_->initialise(windowHnd, renderWindow->getWidth(), renderWindow->getHeight(), true);
     111        inputManager_ = new InputManager(windowHnd);
    126112
    127113        // load master key bindings
    128         masterInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("master", true);
     114        masterInputState_ = InputManager::getInstance().createInputState("master", true);
    129115        masterKeyBinder_ = new KeyBinder();
    130116        masterKeyBinder_->loadBindings("masterKeybindings.ini");
     
    136122        // Load the InGameConsole
    137123        console_ = new InGameConsole();
    138         console_->initialise(renderWindow->getWidth(), renderWindow->getHeight());
     124        console_->initialise();
    139125
    140126        // load the CEGUI interface
     
    149135
    150136        // enable master input
    151         InputManager::getInstance().requestEnterState("master");
     137        InputManager::getInstance().enterState("master");
    152138    }
    153139
     
    169155
    170156        masterInputState_->setHandler(0);
    171         InputManager::getInstance().requestDestroyState("master");
     157        InputManager::getInstance().destroyState("master");
    172158        delete this->masterKeyBinder_;
    173159
     
    232218        this->graphicsManager_->update(time);
    233219    }
    234 
    235     /**
    236     @brief
    237         Window has resized.
    238     @param rw
    239         The render window it occured in
    240     @note
    241         GraphicsManager has a render window stored itself. This is the same
    242         as rw. But we have to be careful when using multiple render windows!
    243     */
    244     void GSGraphics::windowResized(unsigned int newWidth, unsigned int newHeight)
    245     {
    246         // OIS needs this under linux even if we only use relative input measurement.
    247         if (this->inputManager_)
    248             this->inputManager_->setWindowExtents(newWidth, newHeight);
    249     }
    250 
    251     /**
    252     @brief
    253         Window focus has changed.
    254     @param rw
    255         The render window it occured in
    256     */
    257     void GSGraphics::windowFocusChanged()
    258     {
    259         // instruct InputManager to clear the buffers (core library so we cannot use the interface)
    260         if (this->inputManager_)
    261             this->inputManager_->clearBuffers();
    262     }
    263 
    264220}
  • code/trunk/src/orxonox/gamestates/GSGraphics.h

    r3280 r3327  
    3737
    3838#include "OrxonoxPrereqs.h"
    39 
    4039#include "core/GameState.h"
    41 #include "interfaces/WindowEventListener.h"
    4240
    4341namespace orxonox
     
    4947        This game state is only left out if we start a dedicated server where no graphics are present.
    5048    */
    51     class _OrxonoxExport GSGraphics : public GameState, public WindowEventListener
     49    class _OrxonoxExport GSGraphics : public GameState
    5250    {
    5351    public:
    5452        GSGraphics(const GameStateConstrParams& params);
    5553        ~GSGraphics();
    56         void setConfigValues();
    5754
    5855        void activate();
     
    6360
    6461    private:
    65         // Window events from WindowEventListener
    66         void windowResized(unsigned int newWidth, unsigned int newHeight);
    67         void windowFocusChanged();
    68 
    6962        // managed singletons
    7063        InputManager*         inputManager_;        //!< Reference to input management
     
    7568
    7669        KeyBinder*            masterKeyBinder_;     //!< Key binder for master key bindings
    77         SimpleInputState*     masterInputState_;    //!< Special input state for master input
     70        InputState*           masterInputState_;    //!< Special input state for master input
    7871        XMLFile*              debugOverlay_;
    7972        ConsoleCommand*       ccToggleGUI_;         //!< Console command to toggle GUI
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r3280 r3327  
    3131
    3232#include "core/input/InputManager.h"
    33 #include "core/input/SimpleInputState.h"
     33#include "core/input/InputState.h"
    3434#include "core/input/KeyBinder.h"
    3535#include "core/Clock.h"
     
    9090        if (GameMode::showsGraphics())
    9191        {
    92             gameInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game");
     92            gameInputState_ = InputManager::getInstance().createInputState("game");
    9393            keyBinder_ = new KeyBinder();
    9494            keyBinder_->loadBindings("keybindings.ini");
    9595            gameInputState_->setHandler(keyBinder_);
    9696
    97             guiMouseOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiMouseOnly");
     97            guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly");
    9898            guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr());
    9999
    100             guiKeysOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiKeysOnly");
     100            guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
    101101            guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
    102102
     
    134134
    135135            // level is loaded: we can start capturing the input
    136             InputManager::getInstance().requestEnterState("game");
     136            InputManager::getInstance().enterState("game");
    137137        }
    138138    }
     
    144144            GUIManager::getInstance().showGUI("inGameTest");
    145145            GUIManager::getInstance().executeCode("showCursor()");
    146             InputManager::getInstance().requestEnterState("guiMouseOnly");
     146            InputManager::getInstance().enterState("guiMouseOnly");
    147147        }
    148148        else
     
    150150            GUIManager::getInstance().executeCode("hideGUI(\"inGameTest\")");
    151151            GUIManager::getInstance().executeCode("hideCursor()");
    152             InputManager::getInstance().requestLeaveState("guiMouseOnly");
     152            InputManager::getInstance().leaveState("guiMouseOnly");
    153153        }
    154154    }
     
    178178
    179179        if (GameMode::showsGraphics())
    180             InputManager::getInstance().requestLeaveState("game");
     180            InputManager::getInstance().leaveState("game");
    181181
    182182        if (GameMode::isMaster())
     
    218218            guiMouseOnlyInputState_->setHandler(0);
    219219            guiKeysOnlyInputState_->setHandler(0);
    220             InputManager::getInstance().requestDestroyState("game");
     220            InputManager::getInstance().destroyState("game");
    221221            if (this->keyBinder_)
    222222            {
     
    286286                {
    287287                    COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
    288                     InputManager::getInstance().requestEnterState("detector");
     288                    InputManager::getInstance().enterState("detector");
    289289                    bindingString = command;
    290290                    bTemporarySaved = bTemporary;
     
    301301                    COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl;
    302302                    this->keyBinder_->setBinding(bindingString, name, bTemporarySaved);
    303                     InputManager::getInstance().requestLeaveState("detector");
     303                    InputManager::getInstance().leaveState("detector");
    304304                    bound = true;
    305305                }
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r3280 r3327  
    6363
    6464        KeyBinder*            keyBinder_;               //!< tool that loads and manages the input bindings
    65         SimpleInputState*     gameInputState_;          //!< input state for normal ingame playing
    66         SimpleInputState*     guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
    67         SimpleInputState*     guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
     65        InputState*           gameInputState_;          //!< input state for normal ingame playing
     66        InputState*           guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
     67        InputState*           guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
    6868        Radar*                radar_;                   //!< represents the Radar (not the HUD part)
    6969        CameraManager*        cameraManager_;           //!< camera manager for this level
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r3280 r3327  
    3232
    3333#include "core/input/InputManager.h"
    34 #include "core/input/SimpleInputState.h"
     34#include "core/input/InputState.h"
    3535#include "core/Game.h"
    3636#include "core/Clock.h"
     
    5757    void GSMainMenu::activate()
    5858    {
    59         inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("mainMenu");
     59        inputState_ = InputManager::getInstance().createInputState("mainMenu");
    6060        inputState_->setHandler(GUIManager::getInstancePtr());
    61         inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
     61        inputState_->setJoyStickHandler(&InputHandler::EMPTY);
    6262
    6363        // create an empty Scene
     
    9696        }
    9797
    98         InputManager::getInstance().requestEnterState("mainMenu");
     98        InputManager::getInstance().enterState("mainMenu");
    9999
    100100        this->ambient_ = new SoundMainMenu();
     
    106106        delete this->ambient_;
    107107
    108         InputManager::getInstance().requestLeaveState("mainMenu");
    109         InputManager::getInstance().requestDestroyState("mainMenu");
     108        InputManager::getInstance().leaveState("mainMenu");
     109        InputManager::getInstance().destroyState("mainMenu");
    110110
    111111        GUIManager::getInstance().setCamera(0);
  • code/trunk/src/orxonox/gamestates/GSMainMenu.h

    r3280 r3327  
    5353
    5454    private:
    55         SimpleInputState* inputState_;
     55        InputState*      inputState_;
    5656        Scene*            scene_;
    5757        Ogre::Camera*     camera_;
  • code/trunk/src/orxonox/gui/GUIManager.cc

    r3287 r3327  
    6969            void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
    7070        {
    71             int orxonoxLevel;
     71            int orxonoxLevel = CEGUI::Standard;
    7272            switch (level)
    7373            {
     
    366366    void GUIManager::keyPressed(const KeyEvent& evt)
    367367    {
    368         guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text);
     368        guiSystem_->injectKeyDown(evt.getKeyCode());
     369        guiSystem_->injectChar(evt.getText());
    369370    }
    370371    void GUIManager::keyReleased(const KeyEvent& evt)
    371372    {
    372         guiSystem_->injectKeyUp(evt.key);
     373        guiSystem_->injectKeyUp(evt.getKeyCode());
    373374    }
    374375
     
    382383        It is for CEGUI to process the event.
    383384    */
    384     void GUIManager::mouseButtonPressed(MouseButtonCode::ByEnum id)
     385    void GUIManager::buttonPressed(MouseButtonCode::ByEnum id)
    385386    {
    386387        try
     
    404405        It is for CEGUI to process the event.
    405406    */
    406     void GUIManager::mouseButtonReleased(MouseButtonCode::ByEnum id)
     407    void GUIManager::buttonReleased(MouseButtonCode::ByEnum id)
    407408    {
    408409        try
  • code/trunk/src/orxonox/gui/GUIManager.h

    r3280 r3327  
    4444
    4545#include "util/OgreForwardRefs.h"
    46 #include "core/input/InputInterfaces.h"
     46#include "core/input/InputHandler.h"
    4747
    4848// tolua_begin
     
    6262    class _OrxonoxExport GUIManager
    6363// tolua_end
    64         : public KeyHandler, public MouseHandler
     64        : public InputHandler
    6565// tolua_begin
    6666    {
     
    106106        void keyPressed (const KeyEvent& evt);
    107107        void keyReleased(const KeyEvent& evt);
    108         void keyHeld    (const KeyEvent& evt) { }
    109108
    110109        // mouseHandler functions
    111         void mouseButtonPressed (MouseButtonCode::ByEnum id);
    112         void mouseButtonReleased(MouseButtonCode::ByEnum id);
    113         void mouseButtonHeld    (MouseButtonCode::ByEnum id) { }
    114         void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    115         void mouseScrolled      (int abs, int rel);
    116 
    117         void updateInput(float dt)  { }
    118         void updateKey  (float dt)  { }
    119         void updateMouse(float dt)  { }
     110        void buttonPressed (MouseButtonCode::ByEnum id);
     111        void buttonReleased(MouseButtonCode::ByEnum id);
     112        void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
     113        void mouseScrolled (int abs, int rel);
    120114
    121115        Ogre::RenderWindow*         renderWindow_;      //!< Ogre's render window to give CEGUI access to it
  • code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc

    r3196 r3327  
    4040#include "Tickable.h"
    4141#include "TimeFactorListener.h"
    42 #include "WindowEventListener.h"
    4342
    4443#include "core/CoreIncludes.h"
     
    103102
    104103    //----------------------------
    105     // WindowEventListener
    106     //----------------------------
    107     /**
    108         @brief Constructor for the WindowEventListener.
    109     */
    110     WindowEventListener::WindowEventListener()
    111     {
    112         RegisterRootObject(WindowEventListener);
    113     }
    114 
    115     //----------------------------
    116104    // Rewardable
    117105    //----------------------------
  • code/trunk/src/orxonox/objects/pickup/PickupInventory.cc

    r3196 r3327  
    8888            GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
    8989            GUIManager::getInstance().executeCode("hideCursor()");
    90             InputManager::getInstance().requestLeaveState("guiMouseOnly");
     90            InputManager::getInstance().leaveState("guiMouseOnly");
    9191        }
    9292        else
     
    9494            GUIManager::getInstance().showGUI("PickupInventory");
    9595            GUIManager::getInstance().executeCode("showCursor()");
    96             InputManager::getInstance().requestEnterState("guiMouseOnly");
     96            InputManager::getInstance().enterState("guiMouseOnly");
    9797        }
    9898        PickupInventory::getSingleton()->setVisible(!PickupInventory::getSingleton()->isVisible());
  • code/trunk/src/orxonox/overlays/GUIOverlay.cc

    r3301 r3327  
    7070            str = out.str();
    7171            GUIManager::getInstance().executeCode("showCursor()");
    72             InputManager::getInstance().requestEnterState("guiMouseOnly");
     72            InputManager::getInstance().enterState("guiMouseOnly");
    7373            GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")");
    7474        }
     
    7777            GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")");
    7878            GUIManager::getInstance().executeCode("hideCursor()");
    79             InputManager::getInstance().requestLeaveState("guiMouseOnly");
     79            InputManager::getInstance().leaveState("guiMouseOnly");
    8080        }
    8181    }
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r3301 r3327  
    4747#include "core/XMLPort.h"
    4848#include "core/ConsoleCommand.h"
    49 #include "GraphicsManager.h"
    5049
    5150namespace orxonox
     
    8180
    8281        // Get aspect ratio from the render window. Later on, we get informed automatically
    83         Ogre::RenderWindow* defaultWindow = GraphicsManager::getInstance().getRenderWindow();
    84         this->windowAspectRatio_ = static_cast<float>(defaultWindow->getWidth()) / defaultWindow->getHeight();
     82        this->windowAspectRatio_ = static_cast<float>(this->getWindowWidth()) / this->getWindowHeight();
    8583        this->sizeCorrectionChanged();
    8684
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r3196 r3327  
    4242#include "util/OgreForwardRefs.h"
    4343#include "core/BaseObject.h"
    44 #include "interfaces/WindowEventListener.h"
     44#include "core/WindowEventListener.h"
    4545
    4646namespace orxonox
  • code/trunk/src/orxonox/overlays/console/InGameConsole.cc

    r3301 r3327  
    4949#include "core/ConsoleCommand.h"
    5050#include "core/input/InputManager.h"
    51 #include "core/input/SimpleInputState.h"
     51#include "core/input/InputState.h"
    5252#include "core/input/InputBuffer.h"
    5353
     
    9898
    9999        // destroy the input state previously created (InputBuffer gets destroyed by the Shell)
    100         InputManager::getInstance().requestDestroyState("console");
     100        InputManager::getInstance().destroyState("console");
    101101
    102102        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
     
    158158            if (bHidesAllInput_)
    159159            {
    160                 inputState_->setMouseHandler(&InputManager::EMPTY_HANDLER);
    161                 inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
     160                inputState_->setMouseHandler(&InputHandler::EMPTY);
     161                inputState_->setJoyStickHandler(&InputHandler::EMPTY);
    162162            }
    163163            else
     
    172172        @brief Initializes the InGameConsole.
    173173    */
    174     void InGameConsole::initialise(int windowWidth, int windowHeight)
     174    void InGameConsole::initialise()
    175175    {
    176176        // create the corresponding input state
    177         inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("console", false, false, InputStatePriority::Console);
     177        inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console);
    178178        inputState_->setKeyHandler(Shell::getInstance().getInputBuffer());
    179179        bHidesAllInputChanged();
     
    248248        this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_);
    249249
    250         this->windowResized(windowWidth, windowHeight);
     250        this->windowResized(this->getWindowWidth(), this->getWindowWidth());
    251251
    252252        // move overlay "above" the top edge of the screen
     
    507507        {
    508508            this->bActive_ = true;
    509             InputManager::getInstance().requestEnterState("console");
     509            InputManager::getInstance().enterState("console");
    510510            Shell::getInstance().registerListener(this);
    511511
     
    529529        {
    530530            this->bActive_ = false;
    531             InputManager::getInstance().requestLeaveState("console");
     531            InputManager::getInstance().leaveState("console");
    532532            Shell::getInstance().unregisterListener(this);
    533533
  • code/trunk/src/orxonox/overlays/console/InGameConsole.h

    r3196 r3327  
    3636#include "util/OgreForwardRefs.h"
    3737#include "core/Shell.h"
    38 #include "interfaces/WindowEventListener.h"
     38#include "core/WindowEventListener.h"
    3939
    4040namespace orxonox
     
    4646        ~InGameConsole();
    4747
    48         void initialise(int windowWidth, int windowHeight);
     48        void initialise();
    4949        void destroy();
    5050        void setConfigValues();
     
    101101
    102102        // input related
    103         SimpleInputState* inputState_;
     103        InputState* inputState_;
    104104
    105105        // config values
Note: See TracChangeset for help on using the changeset viewer.