Changeset 4346 in orxonox.OLD for orxonox/trunk/src/util/event
- Timestamp:
- May 27, 2005, 11:53:50 PM (20 years ago)
- Location:
- orxonox/trunk/src/util/event
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/event/event.cc
r4329 r4346 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Patrick Boenzli 13 13 co-programmer: ... 14 14 */ 15 15 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT 17 17 18 #include " proto_class.h"18 #include "event.h" 19 19 20 20 using namespace std; … … 25 25 \todo this constructor is not jet implemented - do it 26 26 */ 27 ProtoClass::ProtoClass()27 Event::Event () 28 28 { 29 this->setClassID(CL_ PROTO_ID, "ProtoClass");29 this->setClassID(CL_EVENT, "Event"); 30 30 31 /* If you make a new class, what is most probably the case when you write this file32 don't forget to:33 1. Add the new file new_class.cc to the ./src/Makefile.am34 2. Add the class identifier to ./src/class_list.h eg. CL_NEW_CLASS35 36 Advanced Topics:37 - if you want to let your object be managed via the ObjectManager make sure to read38 the object_manager.h header comments. You will use this most certanly only if you39 make many objects of your class, like a weapon bullet.40 */41 31 } 42 32 … … 46 36 47 37 */ 48 ProtoClass::~ProtoClass()38 Event::~Event () 49 39 { 50 40 // delete what has to be deleted here -
orxonox/trunk/src/util/event/event.h
r4329 r4346 1 1 /*! 2 \file proto_class.h3 \brief Definition of ...2 \file event.h 3 \brief an abstract event 4 4 5 5 */ 6 6 7 #ifndef _ PROTO_CLASS_H8 #define _ PROTO_CLASS_H7 #ifndef _EVENT_H 8 #define _EVENT_H 9 9 10 10 #include "base_object.h" 11 11 12 // FORWARD DEFINITION13 12 14 15 16 //! A class for ... 17 class ProtoClass : public BaseObject { 13 //! An abstract event class 14 class Event : public BaseObject { 18 15 19 16 public: 20 ProtoClass(); 21 virtual ~ProtoClass(); 22 23 24 private: 17 Event(); 18 virtual ~Event(); 25 19 26 20 }; 27 21 28 #endif /* _ PROTO_CLASS_H */22 #endif /* _EVENT_H */ -
orxonox/trunk/src/util/event/event_handler.cc
r4329 r4346 10 10 11 11 ### File Specific: 12 main-programmer: ...13 co-programmer: ...12 main-programmer: Patrick Boenzli 13 co-programmer: 14 14 */ 15 15 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT 17 17 18 #include " proto_singleton.h"18 #include "event_handler.h" 19 19 20 20 using namespace std; … … 24 24 \brief standard constructor 25 25 */ 26 ProtoSingleton::ProtoSingleton()26 EventHandler::EventHandler () 27 27 { 28 this->setClassName("ProtoSingleton"); 29 this->setClassID(CL_PROTO_ID, "ProtoSingleton"); 30 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_list.h eg. CL_NEW_CLASS 35 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 28 this->setClassID(CL_EVENT_HANDLER, "EventHandler"); 41 29 } 42 30 … … 44 32 \brief the singleton reference to this class 45 33 */ 46 ProtoSingleton* ProtoSingleton::singletonRef = NULL;34 EventHandler* EventHandler::singletonRef = NULL; 47 35 48 36 /** 49 37 \returns a Pointer to this Class 50 38 */ 51 ProtoSingleton* ProtoSingleton::getInstance(void)39 EventHandler* EventHandler::getInstance(void) 52 40 { 53 if (! ProtoSingleton::singletonRef)54 ProtoSingleton::singletonRef = new ProtoSingleton();55 return ProtoSingleton::singletonRef;41 if (!EventHandler::singletonRef) 42 EventHandler::singletonRef = new EventHandler(); 43 return EventHandler::singletonRef; 56 44 } 57 45 … … 60 48 61 49 */ 62 ProtoSingleton::~ProtoSingleton()50 EventHandler::~EventHandler () 63 51 { 64 ProtoSingleton::singletonRef = NULL;52 EventHandler::singletonRef = NULL; 65 53 66 54 } -
orxonox/trunk/src/util/event/event_handler.h
r4329 r4346 1 1 /*! 2 \file proto_singleton.h3 \brief Definition of the ... singleton Class2 \file event_handler.h 3 \brief Definition of the EventHandler 4 4 5 5 */ 6 6 7 #ifndef _ PROTO_SINGLETON_H8 #define _ PROTO_SINGLETON_H7 #ifndef _EVENT_HANDLER_H 8 #define _EVENT_HANDLER_H 9 9 10 10 #include "base_object.h" 11 11 12 // FORWARD DEFINITION 12 class EventListener; 13 template<class T> class tList; 13 14 14 //! A default singleton class. 15 class ProtoSingleton : public BaseObject { 15 typedef enum elState 16 { 17 ES_GAME, 18 ES_GAME_MENU, 19 ES_MENU, 20 21 ES_NUMBER, 22 }; 23 24 25 //! The one Event Handler from Orxonox 26 class EventHandler : public BaseObject { 16 27 17 28 public: 18 static ProtoSingleton* getInstance(void); 19 virtual ~ProtoSingleton(void); 29 static EventHandler* getInstance(void); 30 virtual ~EventHandler(void); 31 32 void subscribeListener(EventListener* el, elState state); 33 void unsubscribeListener(EventListener* el, elState state); 34 void flush(); 35 36 void loadKeyBindings(const char* fileName); 37 38 void tick(float t); 20 39 21 40 private: 22 ProtoSingleton(void); 23 static ProtoSingleton* singletonRef; 41 EventHandler(void); 42 static EventHandler* singletonRef; 43 44 EventListener** listeners; //!< a list of registered listeners 45 24 46 }; 25 47 26 #endif /* _ PROTO_SINGLETON_H */48 #endif /* _EVENT_HANDLER_H */ -
orxonox/trunk/src/util/event/event_listener.cc
r4329 r4346 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Patrick Boenzli 13 13 co-programmer: ... 14 14 */ 15 15 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT 17 17 18 #include " proto_class.h"18 #include "event_listener.h" 19 19 20 20 using namespace std; … … 25 25 \todo this constructor is not jet implemented - do it 26 26 */ 27 ProtoClass::ProtoClass()27 EventListener::EventListener () 28 28 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass"); 30 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_list.h eg. CL_NEW_CLASS 35 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 29 this->setClassID(CL_EVENT_LISTENER, "EventListener"); 41 30 } 42 31 … … 46 35 47 36 */ 48 ProtoClass::~ProtoClass()37 EventListener::~EventListener () 49 38 { 50 39 // delete what has to be deleted here -
orxonox/trunk/src/util/event/event_listener.h
r4329 r4346 1 1 /*! 2 \file proto_class.h3 \brief Definition of ...2 \file event_listener.h 3 \brief Definition of an event listener base class 4 4 5 5 */ 6 6 7 #ifndef _ PROTO_CLASS_H8 #define _ PROTO_CLASS_H7 #ifndef _EVENT_LISTENER_H 8 #define _EVENT_LISTENER_H 9 9 10 10 #include "base_object.h" 11 11 12 // FORWARD DEFINITION13 12 14 15 16 //! A class for ... 17 class ProtoClass : public BaseObject { 13 //! A class for event listener 14 class EventListener : public BaseObject { 18 15 19 16 public: 20 ProtoClass();21 virtual ~ ProtoClass();17 EventListener(); 18 virtual ~EventListener(); 22 19 23 24 private:25 20 26 21 }; 27 22 28 #endif /* _ PROTO_CLASS_H */23 #endif /* _EVENT_LISTENER_H */
Note: See TracChangeset
for help on using the changeset viewer.