Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2011, 9:47:11 PM (13 years ago)
Author:
landauf
Message:

merged usability branch back to trunk

incomplete summary of the changes in this branch:

  • enhanced keyboard navigation in GUIs
  • implemented new graphics menu and changeable window size at runtime
  • added developer mode
  • HUD shows if game is paused, game pauses if ingame menu is opened
  • removed a few obsolete commands and hid some that are more for internal use
  • numpad works in console and gui
  • faster loading of level info
  • enhanced usage of compositors (Shader class)
  • improved camera handling, configurable FOV and aspect ratio
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/tools/Timer.h

    r7851 r8079  
    8181#include "core/OrxonoxClass.h"
    8282#include "core/command/Executor.h"
    83 #include "tools/interfaces/TimeFactorListener.h"
    8483
    8584namespace orxonox
    8685{
    87     void delay(float delay, const std::string& command);
    88     void killdelays();
     86    unsigned int delay(float delay, const std::string& command);
     87    unsigned int delayreal(float delay, const std::string& command);
     88
     89    unsigned int addDelayedCommand(Timer* timer, float delay, const std::string& command);
    8990    void executeDelayedCommand(Timer* timer, const std::string& command);
    9091
     92    void killdelay(unsigned int handle);
     93    void killdelays();
     94
    9195    /**
    92         @brief Timer is a helper class that executes a function after a given amount of time.
     96        @brief Timer is a helper class that executes a function after a given amount of seconds in game-time.
    9397
    9498        @see See @ref TimerExample "Timer.h" for an example.
     99
     100        The time interval of Timer depends on the game time, hence it stops if the game is paused or runs
     101        slower/faster if the game-speed is modified. See RealTimer for a timer class which doesn't depend
     102        on the game time.
    95103    */
    96     class _ToolsExport Timer : public TimeFactorListener
     104    class _ToolsExport Timer : virtual public OrxonoxClass
    97105    {
    98106        public:
     
    123131            void run();
    124132
    125             /// Re-starts the Timer: The executor will be called after @a interval seconds.
     133            /// Re-starts the timer: The executor will be called after @a interval seconds.
    126134            inline void startTimer()
    127135                { this->bActive_ = true; this->time_ = this->interval_; }
    128             /// Stops the Timer.
     136            /// Stops the timer.
    129137            inline void stopTimer()
    130138                { this->bActive_ = false; this->time_ = this->interval_; }
    131             /// Pauses the Timer - it will continue with the actual state if you call unpauseTimer().
     139            /// Pauses the timer - it will continue with the actual state if you call unpauseTimer().
    132140            inline void pauseTimer()
    133141                { this->bActive_ = false; }
    134             /// Unpauses the Timer - continues with the given state.
     142            /// Unpauses the timer - continues with the given state.
    135143            inline void unpauseTimer()
    136144                { this->bActive_ = true; }
    137             /// Returns true if the Timer is active (neither stopped nor paused).
     145            /// Returns true if the timer is active (neither stopped nor paused).
    138146            inline bool isActive() const
    139147                { return this->bActive_; }
    140             /// Returns the remaining time until the Timer calls the executor.
     148            /// Returns the remaining time until the timer calls the executor.
    141149            inline float getRemainingTime() const
    142150                { return static_cast<float>(this->time_ / 1000000.0f); }
    143             /// Increases the remaining time of the Timer by the given amount of time (in seconds).
     151            /// Increases the remaining time of the timer by the given amount of time (in seconds).
    144152            inline void addTime(float time)
    145153                { if (time > 0.0f) this->time_ += static_cast<long long>(time * 1000000.0f); }
    146             /// Decreases the remaining time of the Timer by the given amount of time (in seconds)
     154            /// Decreases the remaining time of the timer by the given amount of time (in seconds)
    147155            inline void removeTime(float time)
    148156                { if (time > 0.0f) this->time_ -= static_cast<long long>(time * 1000000.0f); }
     
    156164            void tick(const Clock& time);
    157165
     166        protected:
     167            virtual float getTimeFactor();
     168
    158169        private:
    159170            void init();
     
    163174            long long interval_;    //!< The time-interval in micro seconds
    164175            bool bLoop_;            //!< If true, the executor gets called every @a interval seconds
    165             bool bActive_;          //!< If true, the Timer ticks and calls the executor if the time's up
     176            bool bActive_;          //!< If true, the timer ticks and calls the executor if the time's up
    166177            bool bKillAfterCall_;   //!< If true the timer gets deleted after it expired and called the executor
    167178
    168179            long long time_;        //!< Internal variable, counting the time untill the next executor-call
    169180    };
     181
     182    /**
     183        @brief RealTimer is a helper class that executes a function after a given amount of seconds in real-time.
     184
     185        The time interval of RealTimer doesn't depend on the game time, it will also call the function
     186        if the game is paused. See Timer for a timer class that depends on the game time.
     187    */
     188    class _ToolsExport RealTimer : public Timer
     189    {
     190        public:
     191            RealTimer();
     192            RealTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false);
     193
     194        protected:
     195            virtual float getTimeFactor();
     196    };
    170197}
    171198
Note: See TracChangeset for help on using the changeset viewer.