Changeset 4355 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 28, 2005, 1:19:13 AM (20 years ago)
- Location:
- orxonox/trunk/src/util/event
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/event/event_handler.cc
r4354 r4355 37 37 for(int i = 0; i < ES_NUMBER; ++i) 38 38 this->listeners[i] = new EventListener*[SDLK_LAST]; 39 40 /* now initialize them all to zero */ 41 for(int i = 0; i < ES_NUMBER; ++i) 42 { 43 for(int j = 0; j < SDLK_LAST; ++j) 44 { 45 this->listeners[i][j] = NULL; 46 } 47 } 39 48 } 40 49 … … 182 191 183 192 184 void EventHandler::unsubscribeListener(EventListener* el, elState state) 185 {} 193 void EventHandler::unsubscribeListener(int eventType, elState state) 194 { 195 this->listeners[state][eventType] = NULL; 196 } 186 197 187 198 void EventHandler::flush() 188 {} 199 { 200 for(int i = 0; i < ES_NUMBER; ++i) 201 { 202 for(int j = 0; j < SDLK_LAST; ++j) 203 { 204 this->listeners[i][j] = NULL; 205 } 206 } 207 } 208 209 210 211 void EventHandler::process() 212 { 213 SDL_Event event; 214 //Command cmd; 215 while( SDL_PollEvent (&event)) 216 { 217 // memset (cmd.cmd, 0, CMD_LENGHT); 218 switch( event.type) 219 { 220 case SDL_KEYDOWN: 221 /* 222 strcpy (cmd.cmd, aliases->keys[event.key.keysym.sym]); 223 cmd.bUp = false; 224 if( strlen (cmd.cmd) > 0) relay(&cmd); 225 */ 226 break; 227 case SDL_KEYUP: 228 /* 229 strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]); 230 cmd.bUp = true; 231 if( strlen (cmd.cmd) > 0) relay(&cmd); 232 */ 233 break; 234 case SDL_MOUSEMOTION: 235 /* 236 strcpy( cmd.cmd, "cursor"); 237 cmd.x = event.motion.x; 238 cmd.y = event.motion.y; 239 cmd.xrel = event.motion.xrel; 240 cmd.yrel = event.motion.yrel; 241 if( strlen (cmd.cmd) > 0) relay(&cmd); 242 */ 243 break; 244 case SDL_MOUSEBUTTONUP: 245 /* 246 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 247 cmd.bUp = true; 248 if( strlen (cmd.cmd) > 0) relay(&cmd); 249 */ 250 break; 251 case SDL_MOUSEBUTTONDOWN: 252 /* 253 strcpy( cmd.cmd, aliases->buttons[event.button.button]); 254 cmd.bUp = false; 255 if( strlen (cmd.cmd) > 0) relay(&cmd); 256 */ 257 break; 258 case SDL_JOYAXISMOTION: 259 case SDL_JOYBALLMOTION: 260 case SDL_JOYHATMOTION: 261 case SDL_JOYBUTTONDOWN: 262 case SDL_JOYBUTTONUP: 263 break; 264 default: 265 break; 266 } 267 } 268 } -
orxonox/trunk/src/util/event/event_handler.h
r4354 r4355 50 50 51 51 void subscribeListener(EventListener* el, elState state, int eventType); 52 void unsubscribeListener(EventListener* el, elState state);53 52 void unsubscribeListener(int eventType, elState state); 54 53 void flush();
Note: See TracChangeset
for help on using the changeset viewer.