Changeset 3084 for code/trunk/src/core
- Timestamp:
- May 26, 2009, 9:20:57 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/core/Game.cc
r3037 r3084 185 185 for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin(); 186 186 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 187 193 (*it)->update(*this->gameClock_); 194 195 if ((*it)->getCountTickTime()) 196 this->addTickTime(this->gameClock_->getRealMicroseconds() - timeBeforeTick); 197 } 188 198 189 199 // STATISTICS -
code/trunk/src/core/Game.h
r3037 r3084 43 43 #include "OrxonoxClass.h" 44 44 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__)) 47 52 48 53 // tolua_begin -
code/trunk/src/core/GameState.cc
r2896 r3084 45 45 Constructor only initialises variables and sets the name permanently. 46 46 */ 47 GameState::GameState(const std::string& name )47 GameState::GameState(const std::string& name, bool countTickTime) 48 48 : name_(name) 49 , bCountTickTime_(countTickTime) 49 50 , parent_(0) 50 51 { -
code/trunk/src/core/GameState.h
r2896 r3084 78 78 79 79 public: 80 GameState(const std::string& name );80 GameState(const std::string& name, bool countTicktime = true); 81 81 virtual ~GameState(); 82 82 83 83 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_; } 86 88 87 89 void addChild(GameState* state); … … 102 104 const std::string name_; 103 105 State activity_; 106 const bool bCountTickTime_; 104 107 GameState* parent_; 105 108 std::map<std::string, GameState*> children_; -
code/trunk/src/core/input/InputManager.cc
r2896 r3084 41 41 #include "ois/OISException.h" 42 42 #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 43 49 44 50 #include "util/Exception.h" … … 47 53 #include "core/ConfigValueIncludes.h" 48 54 #include "core/CommandExecutor.h" 49 #include "core/ConsoleCommand.h"50 55 #include "core/CommandLine.h" 51 56 #include "util/Debug.h" … … 64 69 SetConsoleCommand(InputManager, calibrate, true); 65 70 SetConsoleCommand(InputManager, reload, false); 71 #ifdef ORXONOX_PLATFORM_LINUX 72 SetConsoleCommand(InputManager, grabMouse, true); 73 SetConsoleCommand(InputManager, ungrabMouse, true); 74 #endif 66 75 SetCommandLineSwitch(keyboard_no_grab); 67 76 … … 1469 1478 getInstance().reloadInputSystem(joyStickSupport); 1470 1479 } 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 1471 1502 } -
code/trunk/src/core/input/InputManager.h
r2896 r3084 137 137 bool requestEnterState (const std::string& name); 138 138 bool requestLeaveState (const std::string& name); 139 140 #ifdef ORXONOX_PLATFORM_LINUX 141 // HACK! 142 static void grabMouse(); 143 static void ungrabMouse(); 144 #endif 139 145 140 146 void update(const Clock& time);
Note: See TracChangeset
for help on using the changeset viewer.