Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4365 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 28, 2005, 3:24:48 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: event listener/ handler now work together, events are being transmitted to the receivers

Location:
orxonox/trunk/src/util/event
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/event/event_def.h

    r4364 r4365  
    1515#define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf"
    1616
     17#define EVENT_QUEUE_LENGTH 32
    1718
    1819typedef enum extEventTyes
     
    2324    EV_JOY_BALL_MOTION,
    2425    EV_JOY_HAT_MOTION,
    25     EV_JOY_BUTTON
     26    EV_JOY_BUTTON,
     27
     28    EV_NUMBER
    2629  };
    2730
  • orxonox/trunk/src/util/event/event_handler.cc

    r4364 r4365  
    3838  this->listeners = new EventListener**[ES_NUMBER];
    3939  for(int i = 0; i < ES_NUMBER; ++i)
    40     this->listeners[i] = new EventListener*[SDLK_LAST];
     40    this->listeners[i] = new EventListener*[EV_NUMBER];
    4141
    4242  /* now initialize them all to zero */
     
    282282      PRINT(0)("\n==========================| EventHandler::Process () |===\n");
    283283      PRINT(0)("=  Got Event nr%i\n, for state %i", event.type, this->state); 
    284       PRINT(0)("=======================================================\n");
    285284     
    286285      listener = this->listeners[this->state][event.key.keysym.sym];
    287       //if( listener != NULL)
    288       //listener->process();
    289      
    290     }
    291 }
     286      if( listener != NULL)
     287        {
     288          listener->process(ev);
     289          PRINTF(0)("=  Event dispatcher msg: This event has been consumed\n");
     290        }
     291      else
     292        {
     293          PRINTF(0)("=  Event dispatcher msg: This event has NOT been consumed\n");
     294        }
     295
     296      PRINT(0)("=======================================================\n");     
     297    }
     298}
  • orxonox/trunk/src/util/event/event_listener.h

    r4352 r4365  
    99
    1010#include "base_object.h"
     11#include "event.h"
    1112#include "event_def.h"
    1213
     
    1920  virtual ~EventListener();
    2021
     22  virtual void process(const Event &event) = NULL;
     23
     24 private:
     25 
    2126
    2227};
Note: See TracChangeset for help on using the changeset viewer.