comparison examples/tank/tank_main.c @ 153:9870b049b7f6

Make mb_progm_abort() work.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 27 Sep 2008 02:40:42 +0800
parents c65b30e2eda9
children 6ce68c1f7405
comparison
equal deleted inserted replaced
152:2b316b5d65f9 153:9870b049b7f6
106 static void tank_free(tank_t *tank, X_MB_runtime_t *xmb_rt) { 106 static void tank_free(tank_t *tank, X_MB_runtime_t *xmb_rt) {
107 mb_tman_t *tman; 107 mb_tman_t *tman;
108 108
109 if(tank->progm) { 109 if(tank->progm) {
110 tman = X_MB_tman(xmb_rt); 110 tman = X_MB_tman(xmb_rt);
111 mb_progm_abort(tank->progm, tman); 111 mb_progm_abort(tank->progm);
112 } 112 }
113 free(tank); 113 free(tank);
114 } 114 }
115 115
116 /*! \brief Clean program for a tank. 116 /*! \brief Clean program for a tank.
250 return; 250 return;
251 251
252 switch(xkey->sym) { 252 switch(xkey->sym) {
253 case 0xff51: /* left */ 253 case 0xff51: /* left */
254 direction = TD_LEFT; 254 direction = TD_LEFT;
255 tank_move(tank_rt->tank1, direction, tank_rt);
255 break; 256 break;
256 257
257 case 0xff52: /* up */ 258 case 0xff52: /* up */
258 direction = TD_UP; 259 direction = TD_UP;
260 tank_move(tank_rt->tank1, direction, tank_rt);
259 break; 261 break;
260 262
261 case 0xff53: /* right */ 263 case 0xff53: /* right */
262 direction = TD_RIGHT; 264 direction = TD_RIGHT;
265 tank_move(tank_rt->tank1, direction, tank_rt);
263 break; 266 break;
264 267
265 case 0xff54: /* down */ 268 case 0xff54: /* down */
266 direction = TD_DOWN; 269 direction = TD_DOWN;
270 tank_move(tank_rt->tank1, direction, tank_rt);
267 break; 271 break;
268 272
269 case 0x20: /* space */ 273 case 0x20: /* space */
274 break;
270 case 0xff0d: /* enter */ 275 case 0xff0d: /* enter */
271 default: 276 default:
272 return; 277 return;
273 } 278 }
274 279
275 tank_move(tank_rt->tank1, direction, tank_rt);
276 } 280 }
277 281
278 static void init_keyboard(tank_rt_t *tank_rt) { 282 static void init_keyboard(tank_rt_t *tank_rt) {
279 X_MB_runtime_t *mb_rt; 283 X_MB_runtime_t *mb_rt;
280 subject_t *kbevents; 284 subject_t *kbevents;