| 
                Last change
                  on this file since 4827 was
                  4780,
                  checked in by bensch, 20 years ago
           | 
        
        
          | 
               
orxonox/trunk: 1. the crosshair is registered, @patrick: i thought it was a little bit harder… worked myself through the EventSystem, it is quite cool   
 
- Player now knows a loadParams and init routine
 
 
also testing the Crosshair inside of the Player 
 
           | 
        
        | 
            File size:
            1.2 KB
           | 
      
      
        
  | Line |   | 
|---|
| 1 | /*! | 
|---|
| 2 |     \file event_handler.h | 
|---|
| 3 |     \brief Definition of the EventHandler | 
|---|
| 4 |  | 
|---|
| 5 | */ | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef _EVENT_HANDLER_H | 
|---|
| 8 | #define _EVENT_HANDLER_H | 
|---|
| 9 |  | 
|---|
| 10 | #include "base_object.h" | 
|---|
| 11 | #include "key_mapper.h" | 
|---|
| 12 | #include "event_def.h" | 
|---|
| 13 |  | 
|---|
| 14 | class EventListener; | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | //! The one Event Handler from Orxonox | 
|---|
| 18 | class EventHandler : public BaseObject { | 
|---|
| 19 |  | 
|---|
| 20 |  public: | 
|---|
| 21 |   virtual ~EventHandler(); | 
|---|
| 22 |   /** \returns a Pointer to the only object of this Class */ | 
|---|
| 23 |   inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler();  return singletonRef; }; | 
|---|
| 24 |   void init(); | 
|---|
| 25 |  | 
|---|
| 26 |   void setState(elState state); | 
|---|
| 27 |  | 
|---|
| 28 |   void subscribe(EventListener* el, elState state, int eventType); | 
|---|
| 29 |   void unsubscribe(elState state, int eventType); | 
|---|
| 30 |   void unsubscribe(EventListener* el, elState state = ES_ALL); | 
|---|
| 31 |   void flush(elState state); | 
|---|
| 32 |  | 
|---|
| 33 |   void process(); | 
|---|
| 34 |  | 
|---|
| 35 |  private: | 
|---|
| 36 |   EventHandler(); | 
|---|
| 37 |  | 
|---|
| 38 |  | 
|---|
| 39 |  private: | 
|---|
| 40 |   static EventHandler*       singletonRef;                  //!< the singleton reference | 
|---|
| 41 |  | 
|---|
| 42 |   EventListener***           listeners;                     //!< a list of registered listeners | 
|---|
| 43 |   elState                    state;                         //!< the state of the event handlder | 
|---|
| 44 |   KeyMapper*                 keyMapper;                     //!< reference to the key mapper | 
|---|
| 45 | }; | 
|---|
| 46 |  | 
|---|
| 47 | #endif /* _EVENT_HANDLER_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.