Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2800 for code/branches


Ignore:
Timestamp:
Mar 19, 2009, 10:34:54 AM (16 years ago)
Author:
rgrieder
Message:

Renaming "tick" to "update" for all those classes not inheriting from Tickable to avoid confusions.
GameState::ticked still exists, but that's going to change anyway.

Location:
code/branches/gui/src
Files:
30 edited

Legend:

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

    r2799 r2800  
    563563    }
    564564
    565     void Core::tick(const Clock& time)
    566     {
    567         this->tclThreadManager_->tick(time.getDeltaTime());
     565    void Core::update(const Clock& time)
     566    {
     567        this->tclThreadManager_->update(time);
    568568    }
    569569}
  • code/branches/gui/src/core/Core.h

    r2799 r2800  
    6666
    6767            bool isLoaded() { return this->loaded_; }
    68             void tick(const Clock& time);
     68            void update(const Clock& time);
    6969
    7070            static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
  • code/branches/gui/src/core/TclThreadManager.cc

    r1792 r2800  
    3535#include <OgreTimer.h>
    3636
     37#include "Clock.h"
    3738#include "CoreIncludes.h"
    3839#include "ConsoleCommand.h"
     
    598599    }
    599600
    600     void TclThreadManager::tick(float dt)
     601    void TclThreadManager::update(const Clock& time)
    601602    {
    602603        {
     
    633634            boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_);
    634635#endif
    635             unsigned long maxtime = (unsigned long)(dt * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
     636            unsigned long maxtime = (unsigned long)(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
    636637            Ogre::Timer timer;
    637638            while (!this->queueIsEmpty())
  • code/branches/gui/src/core/TclThreadManager.h

    r2710 r2800  
    9090            void debug(const std::string& error);
    9191
    92             virtual void tick(float dt);
     92            void update(const Clock& time);
    9393
    9494            std::list<unsigned int> getThreadList() const;
  • code/branches/gui/src/core/input/CalibratorCallback.h

    r1755 r2800  
    5252        void keyHeld    (const KeyEvent& evt) { }
    5353
    54         void tickInput(float dt) { }
     54        void updateInput(float dt) { }
    5555    };
    5656}
  • code/branches/gui/src/core/input/ExtendedInputState.cc

    r2773 r2800  
    402402    }
    403403
    404     void ExtendedInputState::tickInput(float dt)
     404    void ExtendedInputState::updateInput(float dt)
    405405    {
    406406        for (unsigned int i = 0; i < allHandlers_.size(); ++i)
    407407        {
    408             allHandlers_[i]->tickInput(dt);
    409         }
    410     }
    411 
    412     void ExtendedInputState::tickInput(float dt, unsigned int device)
     408            allHandlers_[i]->updateInput(dt);
     409        }
     410    }
     411
     412    void ExtendedInputState::updateInput(float dt, unsigned int device)
    413413    {
    414414        switch (device)
     
    416416        case Keyboard:
    417417            for (unsigned int i = 0; i < keyHandlers_.size(); ++i)
    418                 keyHandlers_[i]->tickKey(dt);
     418                keyHandlers_[i]->updateKey(dt);
    419419            break;
    420420
    421421        case Mouse:
    422422            for (unsigned int i = 0; i < mouseHandlers_.size(); ++i)
    423                 mouseHandlers_[i]->tickMouse(dt);
     423                mouseHandlers_[i]->updateMouse(dt);
    424424            break;
    425425
    426426        default: // joy sticks
    427427            for (unsigned int i = 0; i < joyStickHandlers_[device - 2].size(); ++i)
    428                 joyStickHandlers_[device - 2][i]->tickJoyStick(dt, device - 2);
     428                joyStickHandlers_[device - 2][i]->updateJoyStick(dt, device - 2);
    429429            break;
    430430        }
  • code/branches/gui/src/core/input/ExtendedInputState.h

    r1887 r2800  
    6868        ~ExtendedInputState() { }
    6969
    70         void tickInput(float dt);
    71         void tickInput(float dt, unsigned int device);
     70        void updateInput(float dt);
     71        void updateInput(float dt, unsigned int device);
    7272
    7373        void keyPressed (const KeyEvent& evt);
  • code/branches/gui/src/core/input/InputBuffer.cc

    r2662 r2800  
    224224
    225225    /**
    226         @brief This tick() function is called by the InputManager if the InputBuffer is active.
     226        @brief This update() function is called by the InputManager if the InputBuffer is active.
    227227        @param dt Delta time
    228228    */
    229     void InputBuffer::tickInput(float dt)
     229    void InputBuffer::updateInput(float dt)
    230230    {
    231231        timeSinceKeyPressed_ += dt;
  • code/branches/gui/src/core/input/InputBuffer.h

    r2662 r2800  
    171171            void processKey (const KeyEvent &e);
    172172
    173             void tickInput(float dt);
    174             void tickKey(float dt) { }
     173            void updateInput(float dt);
     174            void updateKey(float dt) { }
    175175
    176176            std::string buffer_;
  • code/branches/gui/src/core/input/InputInterfaces.h

    r2662 r2800  
    474474    public:
    475475        virtual ~InputHandler() { }
    476         virtual void tickInput(float dt) = 0;
     476        virtual void updateInput(float dt) = 0;
    477477    };
    478478
     
    488488        virtual void keyReleased(const KeyEvent& evt) = 0;
    489489        virtual void keyHeld    (const KeyEvent& evt) = 0;
    490         virtual void tickKey    (float dt) = 0;
     490        virtual void updateKey    (float dt) = 0;
    491491    };
    492492
     
    504504        virtual void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) = 0;
    505505        virtual void mouseScrolled      (int abs, int rel)     = 0;
    506         virtual void tickMouse          (float dt) = 0;
     506        virtual void updateMouse          (float dt) = 0;
    507507    };
    508508
     
    520520        virtual void joyStickButtonHeld    (unsigned int joyStickID, JoyStickButtonCode::ByEnum id) = 0;
    521521        virtual void joyStickAxisMoved     (unsigned int joyStickID, unsigned int axis, float value) = 0;
    522         virtual void tickJoyStick          (float dt, unsigned int joyStick) = 0;
     522        virtual void updateJoyStick          (float dt, unsigned int joyStick) = 0;
    523523    };
    524524
     
    531531        virtual ~EmptyHandler() { }
    532532
    533         void tickInput(float dt) { }
    534         void tickJoyStick(float dt, unsigned int joyStick) { }
    535         void tickMouse(float dt) { }
    536         void tickKey(float dt) { }
     533        void updateInput(float dt) { }
     534        void updateJoyStick(float dt, unsigned int joyStick) { }
     535        void updateMouse(float dt) { }
     536        void updateKey(float dt) { }
    537537
    538538        void keyPressed (const KeyEvent& evt) { }
  • code/branches/gui/src/core/input/InputManager.cc

    r2662 r2800  
    4343
    4444#include "util/Exception.h"
     45#include "core/Clock.h"
    4546#include "core/CoreIncludes.h"
    4647#include "core/ConfigValueIncludes.h"
     
    670671    @brief
    671672        Public interface. Only reloads immediately if the call stack doesn't
    672         include the tick() method.
     673        include the update() method.
    673674    @param joyStickSupport
    674675        Whether or not to initialise joy sticks as well.
     
    742743    @brief
    743744        Updates the states and the InputState situation.
    744     @param dt
    745         Delta time
    746     */
    747     void InputManager::tick(float dt)
     745    @param time
     746        Clock holding the current time.
     747    */
     748    void InputManager::update(const Clock& time)
    748749    {
    749750        if (internalState_ == Uninitialised)
     
    849850                }
    850851
    851             // tick the handlers for each active handler
     852            // update the handlers for each active handler
    852853            for (unsigned int i = 0; i < devicesNum_; ++i)
    853854            {
    854                 activeStatesTop_[i]->tickInput(dt, i);
     855                activeStatesTop_[i]->updateInput(time.getDeltaTime(), i);
    855856                if (stateMaster_->isInputDeviceEnabled(i))
    856                     stateMaster_->tickInput(dt, i);
    857             }
    858 
    859             // tick the handler with a general tick afterwards
     857                    stateMaster_->updateInput(time.getDeltaTime(), i);
     858            }
     859
     860            // update the handler with a general tick afterwards
    860861            for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
    861                 activeStatesTicked_[i]->tickInput(dt);
    862             stateMaster_->tickInput(dt);
     862                activeStatesTicked_[i]->updateInput(time.getDeltaTime());
     863            stateMaster_->updateInput(time.getDeltaTime());
    863864        }
    864865
     
    869870    @brief
    870871        Updates the currently active states (according to activeStates_) for each device.
    871         Also, a list of all active states (no duplicates!) is compiled for the general tick.
     872        Also, a list of all active states (no duplicates!) is compiled for the general update().
    872873    */
    873874    void InputManager::_updateActiveStates()
     
    12901291    @remarks
    12911292        You can't remove the internal states "empty", "calibrator" and "detector".
    1292         The removal process is being postponed if InputManager::tick() is currently running.
     1293        The removal process is being postponed if InputManager::update() is currently running.
    12931294    */
    12941295    bool InputManager::requestDestroyState(const std::string& name)
  • code/branches/gui/src/core/input/InputManager.h

    r2662 r2800  
    125125        bool requestLeaveState     (const std::string& name);
    126126
    127         void tick(float dt);
     127        void update(const Clock& time);
    128128
    129129        static InputManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; }
  • code/branches/gui/src/core/input/InputState.h

    r1887 r2800  
    7171        virtual void unRegisterOnLeave()                      { executorOnLeave_ = 0; }
    7272
    73         virtual void tickInput(float dt, unsigned int device) = 0;
    74         virtual void tickInput(float dt) = 0;
     73        virtual void updateInput(float dt, unsigned int device) = 0;
     74        virtual void updateInput(float dt) = 0;
    7575
    7676        virtual void keyPressed (const KeyEvent& evt) = 0;
  • code/branches/gui/src/core/input/KeyBinder.cc

    r2713 r2800  
    309309    }
    310310
    311     void KeyBinder::tickMouse(float dt)
     311    void KeyBinder::updateMouse(float dt)
    312312    {
    313313        if (bDeriveMouseInput_)
     
    349349            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
    350350            // press a button that has relative movement, that value has to be multiplied by dt to be
    351             // frame rate independent. This can easily (and only) be done in tickInput(float).
     351            // frame rate independent. This can easily (and only) be done in updateInput(float).
    352352            // Hence we need to divide by dt here for the mouse to compensate, because the relative
    353353            // move movements have nothing to do with dt.
     
    362362    }
    363363
    364     void KeyBinder::tickJoyStick(float dt, unsigned int joyStick)
     364    void KeyBinder::updateJoyStick(float dt, unsigned int joyStick)
    365365    {
    366366        for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++)
  • code/branches/gui/src/core/input/KeyBinder.h

    r2710 r2800  
    6868
    6969    protected: // functions
    70         void tickInput(float dt);
    71         void tickKey(float dt) { }
    72         void tickMouse(float dt);
    73         void tickJoyStick(float dt, unsigned int joyStick);
     70        void updateInput(float dt);
     71        void updateKey(float dt) { }
     72        void updateMouse(float dt);
     73        void updateJoyStick(float dt, unsigned int joyStick);
    7474        // internal
    7575        void tickHalfAxis(HalfAxis& halfAxis);
     
    134134        @brief
    135135            Commands that have additional parameters (axes) are executed at the end of
    136             the tick() so that all values can be buffered for single execution.
     136            update() so that all values can be buffered for single execution.
    137137        */
    138138        std::vector<BufferedParamCommand*> paramCommandBuffer_;
     
    200200    { joyStickButtons_[joyStickID][id].execute(KeybindMode::OnHold); }
    201201
    202     inline void KeyBinder::tickInput(float dt)
     202    inline void KeyBinder::updateInput(float dt)
    203203    {
    204204        // execute all buffered bindings (additional parameter)
  • code/branches/gui/src/core/input/SimpleInputState.h

    r1887 r2800  
    5959        ~SimpleInputState() { }
    6060
    61         void tickInput(float dt);
    62         void tickInput(float dt, unsigned int device);
     61        void updateInput(float dt);
     62        void updateInput(float dt, unsigned int device);
    6363
    6464        void keyPressed (const KeyEvent& evt);
     
    8787    };
    8888
    89     inline void SimpleInputState::tickInput(float dt)
     89    inline void SimpleInputState::updateInput(float dt)
    9090    {
    9191        for (unsigned int i = 0; i < allHandlers_.size(); ++i)
    9292        {
    93             allHandlers_[i]->tickInput(dt);
     93            allHandlers_[i]->updateInput(dt);
    9494        }
    9595    }
    9696
    97     inline void SimpleInputState::tickInput(float dt, unsigned int device)
     97    inline void SimpleInputState::updateInput(float dt, unsigned int device)
    9898    {
    9999        switch (device)
     
    101101        case InputDevice::Keyboard:
    102102            if (keyHandler_)
    103                 keyHandler_->tickKey(dt);
     103                keyHandler_->updateKey(dt);
    104104            break;
    105105
    106106        case InputDevice::Mouse:
    107107            if (mouseHandler_)
    108                 mouseHandler_->tickMouse(dt);
     108                mouseHandler_->updateMouse(dt);
    109109            break;
    110110
    111111        default: // joy sticks
    112112            if (joyStickHandler_[device - 2])
    113                 joyStickHandler_[device - 2]->tickJoyStick(dt, device - 2);
     113                joyStickHandler_[device - 2]->updateJoyStick(dt, device - 2);
    114114            break;
    115115        }
  • code/branches/gui/src/network/Client.cc

    r2773 r2800  
    4545#include "Host.h"
    4646#include "synchronisable/Synchronisable.h"
     47#include "core/Clock.h"
    4748#include "core/CoreIncludes.h"
    4849#include "packet/Packet.h"
     
    138139   * @param time
    139140   */
    140   void Client::tick(float time){
     141  void Client::update(const Clock& time){
    141142//     COUT(3) << ".";
    142143    if(client_connection.isConnected() && isSynched_){
  • code/branches/gui/src/network/Client.h

    r2773 r2800  
    7676    //bool sendChat(packet::Chat *chat);
    7777
    78     void tick(float time);
     78    void update(const Clock& time);
    7979
    8080  private:
  • code/branches/gui/src/network/Server.cc

    r2773 r2800  
    5151#include "ClientInformation.h"
    5252#include "util/Sleep.h"
     53#include "core/Clock.h"
    5354#include "core/ConsoleCommand.h"
    5455#include "core/CoreIncludes.h"
     
    149150  * @param time time since last tick
    150151  */
    151   void Server::tick(float time) {
     152  void Server::update(const Clock& time) {
    152153    processQueue();
    153154    //this steers our network frequency
    154     timeSinceLastUpdate_+=time;
     155    timeSinceLastUpdate_+=time.getDeltaTime();
    155156    if(timeSinceLastUpdate_>=NETWORK_PERIOD){
    156157      timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
  • code/branches/gui/src/network/Server.h

    r2662 r2800  
    7171    bool processChat(const std::string& message, unsigned int playerID);
    7272    bool queuePacket(ENetPacket *packet, int clientID);
    73     void tick(float time);
     73    void update(const Clock& time);
    7474    unsigned int getPing(unsigned int clientID);
    7575    double getPacketLoss(unsigned int clientID);
  • code/branches/gui/src/orxonox/gamestates/GSClient.cc

    r2171 r2800  
    3131
    3232#include "core/input/InputManager.h"
     33#include "core/Clock.h"
    3334#include "core/CommandLine.h"
    3435#include "core/Core.h"
     
    6061        GSLevel::enter(this->getParent()->getViewport());
    6162
    62         client_->tick(0);
     63        // TODO: Get Clock from Game or GameStateManager, but with 0 delta time
     64        client_->update(Clock());
    6365    }
    6466
     
    7880    {
    7981        GSLevel::ticked(time);
    80         client_->tick(time.getDeltaTime());
     82        client_->update(time);
    8183
    8284        this->tickChild(time);
  • code/branches/gui/src/orxonox/gamestates/GSDedicated.cc

    r2662 r2800  
    3030#include "GSDedicated.h"
    3131
     32#include "core/Clock.h"
    3233#include "core/CommandLine.h"
    3334#include "core/Core.h"
     
    8384            timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
    8485            GSLevel::ticked(time);
    85             server_->tick(time.getDeltaTime());
     86            server_->update(time);
    8687            this->tickChild(time);
    8788        }
  • code/branches/gui/src/orxonox/gamestates/GSGUI.cc

    r2790 r2800  
    3131
    3232#include <OgreViewport.h>
     33#include "core/Clock.h"
    3334#include "core/input/InputManager.h"
    3435#include "core/input/SimpleInputState.h"
     
    6465    {
    6566        // tick CEGUI
    66         guiManager_->tick(time.getDeltaTime());
     67        guiManager_->update(time);
    6768
    6869        this->tickChild(time);
  • code/branches/gui/src/orxonox/gamestates/GSGraphics.cc

    r2759 r2800  
    233233        float dt = time.getDeltaTime();
    234234
    235         this->inputManager_->tick(dt);
     235        this->inputManager_->update(time);
    236236        // tick console
    237         this->console_->tick(dt);
     237        this->console_->update(time);
    238238        this->tickChild(time);
    239239
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r2799 r2800  
    134134        uint64_t timeBeforeTick = time.getRealMicroseconds();
    135135
    136         Core::getInstance().tick(time);
     136        Core::getInstance().update(time);
    137137
    138138        for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)
  • code/branches/gui/src/orxonox/gamestates/GSServer.cc

    r2171 r2800  
    7373    {
    7474        GSLevel::ticked(time);
    75         server_->tick(time.getDeltaTime());
     75        server_->update(time);
    7676        this->tickChild(time);
    7777    }
  • code/branches/gui/src/orxonox/gamestates/GSStandalone.cc

    r2790 r2800  
    8686        }
    8787        // tick CEGUI
    88         guiManager_->tick(time.getDeltaTime());
     88        guiManager_->update(time);
    8989
    9090        GSLevel::ticked(time);
  • code/branches/gui/src/orxonox/gui/GUIManager.h

    r2790 r2800  
    4040#include <CEGUIInputEvent.h>
    4141#include <CEGUISystem.h>
     42#include "core/Clock.h"
    4243#include "core/input/InputInterfaces.h"
    4344
     
    7172        bool initialise(Ogre::RenderWindow* renderWindow);
    7273        void loadScene(const std::string& name);
    73         void tick(float dt)
     74        void update(const Clock& time)
    7475        {
    7576            assert(guiSystem_);
    76             guiSystem_->injectTimePulse(dt);
     77            guiSystem_->injectTimePulse(time.getDeltaTime());
    7778        }
    7879        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
     
    108109        { guiSystem_->injectMouseWheelChange(rel);}
    109110
    110         void tickInput(float dt) { }
    111         void tickKey(float dt) { }
    112         void tickMouse(float dt) { }
     111        void updateInput(float dt) { }
     112        void updateKey(float dt) { }
     113        void updateMouse(float dt) { }
    113114
    114115        void loadScenes();
  • code/branches/gui/src/orxonox/overlays/console/InGameConsole.cc

    r2087 r2800  
    4242#include "util/Convert.h"
    4343#include "util/Debug.h"
     44#include "core/Clock.h"
    4445#include "core/CoreIncludes.h"
    4546#include "core/ConfigValueIncludes.h"
     
    347348        @brief Used to control the actual scrolling and the cursor.
    348349    */
    349     void InGameConsole::tick(float dt)
     350    void InGameConsole::update(const Clock& time)
    350351    {
    351352        if (this->scroll_ != 0)
     
    358359                // enlarge oldTop a little bit so that this exponential function
    359360                // reaches 0 before infinite time has passed...
    360                 float deltaScroll = (oldTop - 0.01) * dt * this->scrollSpeed_;
     361                float deltaScroll = (oldTop - 0.01) * time.getDeltaTime() * this->scrollSpeed_;
    361362                if (oldTop - deltaScroll >= 0)
    362363                {
     
    373374                // scrolling up
    374375                // note: +0.01 for the same reason as when scrolling down
    375                 float deltaScroll = (1.2 * this->relativeHeight + 0.01 + oldTop) * dt * this->scrollSpeed_;
     376                float deltaScroll = (1.2 * this->relativeHeight + 0.01 + oldTop) * time.getDeltaTime() * this->scrollSpeed_;
    376377                if (oldTop - deltaScroll <= -1.2 * this->relativeHeight)
    377378                {
     
    388389        if (this->bActive_)
    389390        {
    390             this->cursor_ += dt;
     391            this->cursor_ += time.getDeltaTime();
    391392            if (this->cursor_ >= this->blinkTime)
    392393            {
  • code/branches/gui/src/orxonox/overlays/console/InGameConsole.h

    r2087 r2800  
    5353        void setConfigValues();
    5454
    55         virtual void tick(float dt);
     55        void update(const Clock& time);
    5656
    5757        static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
Note: See TracChangeset for help on using the changeset viewer.