Changeset 6387 for code/branches/presentation2/src/libraries/core
- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries/core
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/BaseObject.cc
r5929 r6387 119 119 XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*); 120 120 XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode); 121 121 122 122 Element* events = 0; 123 123 if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject) … … 139 139 XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode); 140 140 XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode); 141 141 142 142 this->bRegisteredEventStates_ = true; 143 143 } … … 236 236 if (it->second != state) 237 237 continue; 238 238 239 239 if (i == index) 240 240 return it->first; … … 252 252 listener->addEventSource(this, "mainstate"); 253 253 } 254 254 255 255 /** 256 256 @brief Returns an event listener with a given index. … … 344 344 { 345 345 this->registerEventStates(); 346 346 347 347 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_); 348 348 if (it != this->eventStates_.end()) … … 356 356 /** 357 357 @brief Sets the main state of the object to a given boolean value. 358 358 359 359 Note: The main state of an object can be set with the @ref setMainStateName function. 360 360 It's part of the eventsystem and used for event forwarding (when the target object can't specify a specific state, … … 389 389 { 390 390 this->registerEventStates(); 391 391 392 392 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_); 393 393 if (it != this->eventStates_.end() && it->second->getFunctor()) … … 402 402 } 403 403 } 404 404 405 405 /** 406 406 @brief Calls XMLEventPort with an empty XML-element to register the event states if necessary. … … 414 414 } 415 415 } 416 416 417 417 /** 418 418 @brief Manually loads all event states, even if the class doesn't officially support them. This is needed by some classes like @ref EventDispatcher or @ref EventTarget. -
code/branches/presentation2/src/libraries/core/BaseObject.h
r5929 r6387 157 157 void removeEventSource(BaseObject* source); 158 158 BaseObject* getEventSource(unsigned int index, const std::string& state) const; 159 159 160 160 void addEventListener(BaseObject* listener); 161 161 BaseObject* getEventListener(unsigned int index) const; … … 172 172 /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */ 173 173 inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; } 174 174 175 175 static void loadAllEventStates(Element& xmlelement, XMLPort::Mode mode, BaseObject* object, Identifier* identifier); 176 176 … … 210 210 Gametype* oldGametype_; 211 211 std::set<Template*> templates_; 212 212 213 213 std::map<BaseObject*, std::string> eventSources_; //!< List of objects which send events to this object, mapped to the state which they affect 214 214 std::set<BaseObject*> eventListeners_; //!< List of objects which listen to the events of this object -
code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
r6197 r6387 57 57 return false; 58 58 } 59 59 60 60 std::string getConfig(const std::string& classname, const std::string& varname) 61 61 { -
code/branches/presentation2/src/libraries/core/Event.cc
r5929 r6387 45 45 /** 46 46 @brief Processes an event (calls the set-function if the necessary conditions are met). 47 47 48 48 @param event The fired event 49 49 @param object The object whose state is affected by the event (only needed for debug output) -
code/branches/presentation2/src/libraries/core/Event.h
r5929 r6387 50 50 /** 51 51 @brief The EventState contains information about an event state. 52 52 53 53 An event state is a state of an object, which can be changed by events. 54 54 Event states are changed through functions. Possible functions headers for set event states are: … … 56 56 - boolean state: function(bool state) 57 57 - individual state: function(bool state, SomeClass originator) 58 58 59 59 Note that SomeClass may be any class deriving from BaseObject. You will not receive events from originators of other classes. 60 60 The actual class for SomeClass must be specified as the second argument of the XMLPortEventState macro. 61 61 62 62 The this pointer of the affected object is hidden in the functors, because the events are processed in the BaseObject, but some 63 63 statefunctions may be from child-classes. … … 70 70 71 71 void process(const Event& event, BaseObject* object); 72 72 73 73 Functor* getFunctor() const 74 74 { return this->statefunction_; } -
code/branches/presentation2/src/libraries/core/EventIncludes.h
r5929 r6387 36 36 /** 37 37 @brief Defines a new event state (a state of the object which can be changed by events). 38 38 39 39 @param classname The name of this class 40 40 @param subclassname Usually BaseObject - if different, only instances of this class can send events to this object … … 69 69 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \ 70 70 XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true) 71 71 72 72 73 73 /** 74 74 @brief Defines a new event name for a class. Named events can only have names which were defined with this macro. 75 75 76 76 @param classname The name of the class 77 77 @param name The name of the event … … 85 85 #define FireEventName(classname, name) \ 86 86 eventname##classname##name 87 87 88 88 #endif /* _EventIncludes_H__ */ -
code/branches/presentation2/src/libraries/core/GUIManager.cc
r6367 r6387 66 66 { GUIManager::getInstance().keyESC(); } 67 67 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC"); 68 68 69 69 class CEGUILogger : public CEGUI::DefaultLogger 70 70 { … … 246 246 this->executeCode("keyESC()"); 247 247 } 248 248 249 249 void GUIManager::setBackground(const std::string& name) 250 250 { -
code/branches/presentation2/src/libraries/core/OrxonoxClass.h
r6348 r6387 149 149 this->destroy(); 150 150 } 151 151 152 152 /** @brief Register a weak pointer which points to this object. */ 153 153 template <class T> -
code/branches/presentation2/src/libraries/core/SmartPtr.h
r5929 r6387 84 84 this->base_->decrementReferenceCount(); 85 85 } 86 86 87 87 inline const SmartPtr& operator=(int) 88 88 { -
code/branches/presentation2/src/libraries/core/Thread.cc
r5738 r6387 41 41 { 42 42 boost::posix_time::millisec THREAD_WAIT_BEFORE_DETACH(1000); 43 44 43 44 45 45 Thread::Thread(): 46 46 executor_(0), … … 53 53 this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) ); 54 54 } 55 55 56 56 Thread::~Thread() 57 57 { … … 66 66 delete this->isWorkingMutex_; 67 67 } 68 68 69 69 bool Thread::isWorking() 70 70 { … … 74 74 return isWorking; 75 75 } 76 76 77 77 bool Thread::evaluateExecutor( Executor* executor ) 78 78 { … … 85 85 return true; 86 86 } 87 87 88 88 void Thread::threadLoop() 89 89 { … … 114 114 } 115 115 } 116 116 117 117 void Thread::waitUntilFinished() 118 118 { -
code/branches/presentation2/src/libraries/core/Thread.h
r5738 r6387 50 50 private: 51 51 void threadLoop(); 52 52 53 53 Executor* executor_; 54 54 bool isWorking_; -
code/branches/presentation2/src/libraries/core/ThreadPool.cc
r5738 r6387 37 37 { 38 38 } 39 39 40 40 ThreadPool::~ThreadPool() 41 41 { … … 43 43 assert(a == 0); 44 44 } 45 45 46 46 void ThreadPool::addThreads( unsigned int nr ) 47 47 { … … 80 80 } 81 81 } 82 82 83 83 bool ThreadPool::passFunction( Executor* executor, bool addThread ) 84 84 { … … 103 103 return false; 104 104 } 105 105 106 106 void ThreadPool::synchronise() 107 107 { -
code/branches/presentation2/src/libraries/core/ThreadPool.h
r5738 r6387 41 41 ThreadPool(); 42 42 virtual ~ThreadPool(); 43 43 44 44 void addThreads( unsigned int nr ); 45 45 unsigned int removeThreads( unsigned int nr ); 46 46 unsigned int setNrOfThreads( unsigned int nr ); 47 47 48 48 bool passFunction( Executor* executor, bool addThread=false ); 49 49 void synchronise(); 50 50 51 51 private: 52 52 std::vector<Thread*> threadPool_; 53 53 54 54 }; 55 55 } -
code/branches/presentation2/src/libraries/core/WeakPtr.h
r5929 r6387 44 44 { 45 45 friend class OrxonoxClass; 46 46 47 47 public: 48 48 inline WeakPtr() : pointer_(0), base_(0), callback_(0) … … 79 79 if (this->callback_) 80 80 delete this->callback_; 81 82 } 83 81 82 } 83 84 84 inline const WeakPtr& operator=(int) 85 85 { … … 145 145 if (other.base_) 146 146 other.base_->unregisterWeakPtr(&other); 147 147 148 148 { 149 149 T* temp = this->pointer_; … … 167 167 WeakPtr().swap(*this); 168 168 } 169 169 170 170 inline void setCallback(Functor* callback) 171 171 { 172 172 this->callback_ = callback; 173 173 } 174 174 175 175 inline Functor* getFunctor() const 176 176 { … … 186 186 (*this->callback_)(); 187 187 } 188 188 189 189 T* pointer_; 190 190 OrxonoxClass* base_; -
code/branches/presentation2/src/libraries/core/input/InputManager.h
r6278 r6387 83 83 @brief 84 84 Loads the devices and initialises the KeyDetector and the Calibrator. 85 85 86 86 If either the OIS input system and/or the keyboard could not be created, 87 87 the constructor fails with an std::exception. … … 170 170 OIS::InputManager* getOISInputManager() { return this->oisInputManager_; } 171 171 std::pair<int, int> getMousePosition() const; 172 172 173 173 static InputManager& getInstance() { return Singleton<InputManager>::getInstance(); } // tolua_export 174 174 -
code/branches/presentation2/src/libraries/core/input/InputPrereqs.h
r5781 r6387 202 202 MediaSelect = OIS::KC_MEDIASELECT // Media Select 203 203 }; 204 204 205 205 //! Key codes as strings 206 206 const char* const ByString[] = -
code/branches/presentation2/src/libraries/core/input/InputState.cc
r5929 r6387 102 102 if (enterFunctor_) 103 103 (*enterFunctor_)(); 104 104 105 105 } 106 106 -
code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
r6360 r6387 283 283 } 284 284 } 285 285 286 286 void KeyBinder::addButtonToCommand(std::string command, Button* button) 287 287 { 288 288 std::ostringstream stream; 289 289 stream << button->groupName_ << "." << button->name_; 290 290 291 291 std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_]; 292 292 std::vector<std::string>::iterator it = std::find(oldKeynames.begin(), oldKeynames.end(), stream.str()); … … 295 295 oldKeynames.erase(it); 296 296 } 297 297 298 298 if(command != "") 299 299 { … … 305 305 } 306 306 } 307 307 308 308 /** 309 309 @brief … … 317 317 return keynames.front(); 318 318 } 319 319 320 320 return ""; 321 321 } 322 322 323 323 /** 324 324 @brief … … 338 338 return keynames[index]; 339 339 } 340 340 341 341 return ""; 342 342 } 343 343 344 344 return ""; 345 345 } 346 346 347 347 /** 348 348 @brief … … 358 358 return keynames.size(); 359 359 } 360 360 361 361 return 0; 362 362 } -
code/branches/presentation2/src/libraries/core/input/KeyBinder.h
r6311 r6387 69 69 std::string getBinding(std::string commandName, unsigned int index); //tolua_export 70 70 unsigned int getNumberOfBindings(std::string commandName); //tolua_export 71 71 72 72 const std::string& getBindingsFilename() 73 73 { return this->filename_; } … … 161 161 private: 162 162 void addButtonToCommand(std::string command, Button* button); 163 163 164 164 //##### ConfigValues ##### 165 165 //! Whether to filter small value analog input -
code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc
r6367 r6387 92 92 this->bDefaultFileLoaded_ = false; 93 93 } 94 94 95 95 inline void KeyBinderManager::unbind(const std::string& binding) 96 96 { 97 97 this->currentBinder_->setBinding("", binding, false); 98 98 } 99 99 100 100 inline void KeyBinderManager::tunbind(const std::string& binding) 101 101 {
Note: See TracChangeset
for help on using the changeset viewer.