Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4364 in orxonox.OLD for orxonox/trunk/src/util/event


Ignore:
Timestamp:
May 28, 2005, 3:14:43 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: filled the flush function with more sense :) and rearanged some structures

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

Legend:

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

    r4363 r4364  
    1111
    1212#define CMD_LENGHT 16
     13#define N_STD_KEYS SDLK_LAST
     14#define N_BUTTONS 6
     15#define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf"
     16
    1317
    1418typedef enum extEventTyes
     
    2226  };
    2327
     28typedef enum elState
     29  {
     30    ES_GAME,
     31    ES_GAME_MENU,
     32    ES_MENU,
     33
     34    ES_ALL,
     35
     36    ES_NUMBER,
     37  };
     38
    2439
    2540#endif /* _EVENT_DEF_H */
  • orxonox/trunk/src/util/event/event_handler.cc

    r4363 r4364  
    198198}
    199199
    200 void EventHandler::flush()
    201 {
    202   for(int i = 0; i < ES_NUMBER; ++i)
     200void EventHandler::flush(elState state)
     201{
     202  if( state == ES_ALL)
     203    {
     204      for(int i = 0; i < ES_NUMBER; ++i)
     205        {
     206          for(int j = 0; j < SDLK_LAST; ++j)
     207            {
     208              this->listeners[i][j] = NULL;
     209            }
     210        }
     211    }
     212  else
    203213    {
    204214      for(int j = 0; j < SDLK_LAST; ++j)
    205215        {
    206           this->listeners[i][j] = NULL;
     216          this->listeners[state][j] = NULL;
    207217        }
    208218    }
     
    214224{
    215225  SDL_Event event;
    216   //Command cmd;
    217226  Event ev;
    218227  EventListener* listener;
     
    270279        }
    271280
     281      /* small debug routine: shows alle events dispatched by the event handler */
     282      PRINT(0)("\n==========================| EventHandler::Process () |===\n");
     283      PRINT(0)("=  Got Event nr%i\n, for state %i", event.type, this->state); 
     284      PRINT(0)("=======================================================\n");
     285     
    272286      listener = this->listeners[this->state][event.key.keysym.sym];
    273287      //if( listener != NULL)
  • orxonox/trunk/src/util/event/event_handler.h

    r4362 r4364  
    1515
    1616
    17 #define N_STD_KEYS SDLK_LAST
    18 #define N_BUTTONS 6
    19 #define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf"
    20 
    21 typedef enum elState
    22   {
    23     ES_GAME,
    24     ES_GAME_MENU,
    25     ES_MENU,
    26 
    27     ES_ALL,
    28 
    29     ES_NUMBER,
    30   };
    3117
    3218//! Key aliasing structure
     
    5339  void subscribeListener(EventListener* el, elState state, int eventType);
    5440  void unsubscribeListener(int eventType, elState state);
    55   void flush();
     41  void flush(elState state);
    5642 
    5743  void loadKeyBindings(const char* fileName);
Note: See TracChangeset for help on using the changeset viewer.