Mercurial > MadButterfly
view src/mbaf/mbapp.c @ 455:58b6337fb3b2
Fix bugs of pending keys of animated menu.
- When more than one pending key, the animation would be stoped.
- Now, we have a cyclic queue to keep at most 15 pending keys to
make sure pending keys being dispatched without stop current animation
program.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 06 Aug 2009 13:15:57 +0800 |
parents | 9b8dda201ccb |
children | 26c302b47de1 |
line wrap: on
line source
#include <mb.h> #include <mbapp.h> mbaf_t *mbaf_init(const char *module, const char *module_dir) { mbaf_t *app = (mbaf_t *) malloc(sizeof(mbaf_t)); X_MB_runtime_t *rt; rt = X_MB_new(":0.0", 800, 600); if(rt == NULL) return NULL; sprite_set_search_path(module_dir); app->rt = rt; app->rdman = X_MB_rdman(rt); app->kbevents = X_MB_kbevents(rt); app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord); if(app->rootsprite == NULL) { X_MB_free(rt); free(app); return NULL; } rdman_attach_backend(app->rdman, rt); MB_SPRITE_GOTO_SCENE(app->rootsprite, 1); return app; } void mbaf_set_data(mbaf_t *app,void *data) { app->private = (void *) data; } mb_tman_t *mbaf_get_timer(mbaf_t *app) { return X_MB_tman(app->rt); } void mbaf_loop(mbaf_t *app) { /* * Start handle connections, includes one to X server. * User start to interact with the application. */ X_MB_handle_connection(app->rt); /* * Clean */ X_MB_free(app->rt); free(app); }