Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3084 for code/trunk/src/core


Ignore:
Timestamp:
May 26, 2009, 9:20:57 PM (16 years ago)
Author:
landauf
Message:

merged netp3 branch back to trunk

Location:
code/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/Game.cc

    r3037 r3084  
    185185            for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin();
    186186                it != this->activeStates_.end(); ++it)
     187            {
     188                // Add tick time for most of the states
     189                uint64_t timeBeforeTick;
     190                if ((*it)->getCountTickTime())
     191                    timeBeforeTick = this->gameClock_->getRealMicroseconds();
     192               
    187193                (*it)->update(*this->gameClock_);
     194
     195                if ((*it)->getCountTickTime())
     196                    this->addTickTime(this->gameClock_->getRealMicroseconds() - timeBeforeTick);
     197            }
    188198
    189199            // STATISTICS
  • code/trunk/src/core/Game.h

    r3037 r3084  
    4343#include "OrxonoxClass.h"
    4444
    45 #define AddGameState(classname, name) \
    46     static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(name))
     45/**
     46@def
     47    Adds a new GameState to the Game. The second parameter is the name as string
     48    and every following paramter is a constructor argument (which is usually non existent)
     49*/
     50#define AddGameState(classname, ...) \
     51    static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__))
    4752
    4853// tolua_begin
  • code/trunk/src/core/GameState.cc

    r2896 r3084  
    4545        Constructor only initialises variables and sets the name permanently.
    4646    */
    47     GameState::GameState(const std::string& name)
     47    GameState::GameState(const std::string& name, bool countTickTime)
    4848        : name_(name)
     49        , bCountTickTime_(countTickTime)
    4950        , parent_(0)
    5051    {
  • code/trunk/src/core/GameState.h

    r2896 r3084  
    7878
    7979    public:
    80         GameState(const std::string& name);
     80        GameState(const std::string& name, bool countTicktime = true);
    8181        virtual ~GameState();
    8282
    8383        const std::string& getName() const { return name_; }
    84         State getActivity() const    { return this->activity_; }
    85         GameState* getParent() const       { return this->parent_; }
     84        State getActivity()          const { return this->activity_; }
     85        GameState* getParent()       const { return this->parent_; }
     86
     87        bool getCountTickTime()      const { return this->bCountTickTime_; }
    8688
    8789        void addChild(GameState* state);
     
    102104        const std::string                        name_;
    103105        State                                    activity_;
     106        const bool                               bCountTickTime_;
    104107        GameState*                               parent_;
    105108        std::map<std::string, GameState*>        children_;
  • code/trunk/src/core/input/InputManager.cc

    r2896 r3084  
    4141#include "ois/OISException.h"
    4242#include "ois/OISInputManager.h"
     43#include "core/ConsoleCommand.h"
     44
     45// HACK
     46#ifdef ORXONOX_PLATFORM_LINUX
     47#  include "ois/linux/LinuxMouse.h"
     48#endif
    4349
    4450#include "util/Exception.h"
     
    4753#include "core/ConfigValueIncludes.h"
    4854#include "core/CommandExecutor.h"
    49 #include "core/ConsoleCommand.h"
    5055#include "core/CommandLine.h"
    5156#include "util/Debug.h"
     
    6469    SetConsoleCommand(InputManager, calibrate, true);
    6570    SetConsoleCommand(InputManager, reload, false);
     71#ifdef ORXONOX_PLATFORM_LINUX
     72    SetConsoleCommand(InputManager, grabMouse, true);
     73    SetConsoleCommand(InputManager, ungrabMouse, true);
     74#endif
    6675    SetCommandLineSwitch(keyboard_no_grab);
    6776
     
    14691478        getInstance().reloadInputSystem(joyStickSupport);
    14701479    }
     1480
     1481
     1482    // ############################################################
     1483    // #####                   ugly hacks                     #####
     1484    // ##########                                        ##########
     1485    // ############################################################
     1486
     1487#ifdef ORXONOX_PLATFORM_LINUX
     1488    void InputManager::grabMouse()
     1489    {
     1490        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
     1491        assert(linuxMouse);
     1492        linuxMouse->grab(true);
     1493    }
     1494
     1495    void InputManager::ungrabMouse()
     1496    {
     1497        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(singletonRef_s->mouse_);
     1498        assert(linuxMouse);
     1499        linuxMouse->grab(false);
     1500    }
     1501#endif
    14711502}
  • code/trunk/src/core/input/InputManager.h

    r2896 r3084  
    137137        bool requestEnterState     (const std::string& name);
    138138        bool requestLeaveState     (const std::string& name);
     139
     140#ifdef ORXONOX_PLATFORM_LINUX
     141        // HACK!
     142        static void grabMouse();
     143        static void ungrabMouse();
     144#endif
    139145
    140146        void update(const Clock& time);
Note: See TracChangeset for help on using the changeset viewer.