Mercurial > MadButterfly
comparison examples/menu/main.c @ 454:9b8dda201ccb
Make naming convention consistent with MadButterfly.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 06 Aug 2009 09:38:51 +0800 |
parents | 84ce2d4a8c3f |
children | 26c302b47de1 |
comparison
equal
deleted
inserted
replaced
453:84ce2d4a8c3f | 454:9b8dda201ccb |
---|---|
40 "Item 18", | 40 "Item 18", |
41 }; | 41 }; |
42 | 42 |
43 typedef struct { | 43 typedef struct { |
44 mb_animated_menu_t *m; | 44 mb_animated_menu_t *m; |
45 }MyAppData; | 45 }app_data_t; |
46 | 46 |
47 MBApp *myApp; | 47 mbaf_t *app; |
48 | 48 |
49 | 49 |
50 | 50 |
51 void myselect(mb_animated_menu_t *m, int select) | 51 void myselect(mb_animated_menu_t *m, int select) |
52 { | 52 { |
53 printf("menu %d is selected\n", select); | 53 printf("menu %d is selected\n", select); |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 MyApp_InitContent() | 57 app_init_content() |
58 { | 58 { |
59 MyAppData *data = MBAPP_DATA(myApp,MyAppData); | 59 app_data_t *data = MBAF_DATA(app,app_data_t); |
60 subject_t *key = MBAPP_keySubject(myApp); | 60 subject_t *key = MBAF_KB_SUBJECT(app); |
61 char name[255]; | 61 char name[255]; |
62 coord_t *l; | 62 coord_t *l; |
63 int i; | 63 int i; |
64 mb_sprite_t *sprite=myApp->rootsprite; | 64 mb_sprite_t *sprite=app->rootsprite; |
65 | 65 |
66 data->m = mb_animated_menu_new(myApp,myApp->rootsprite,"item",menus); | 66 data->m = mb_animated_menu_new(app,app->rootsprite,"item",menus); |
67 mb_animated_menu_set_callback(data->m, myselect); | 67 mb_animated_menu_set_callback(data->m, myselect); |
68 } | 68 } |
69 | 69 |
70 int main(int argc, char * const argv[]) { | 70 int main(int argc, char * const argv[]) { |
71 subject_t *subject; | 71 subject_t *subject; |
72 mb_obj_t *button; | 72 mb_obj_t *button; |
73 MyAppData data; | 73 app_data_t data; |
74 mb_timeval_t tmo,interval; | 74 mb_timeval_t tmo,interval; |
75 | 75 |
76 if (argc > 1) | 76 if (argc > 1) |
77 myApp = MBApp_Init(argv[1], ""); | 77 app = mbaf_init(argv[1], ""); |
78 else | 78 else |
79 myApp = MBApp_Init("list", ".libs"); | 79 app = mbaf_init("list", ".libs"); |
80 MBApp_setData(myApp,&data); | 80 mbaf_set_data(app,&data); |
81 MyApp_InitContent(); | 81 app_init_content(); |
82 | 82 |
83 MBApp_loop(myApp); | 83 mbaf_loop(app); |
84 | 84 |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 /* vim: set ts=4 */ | 88 /* vim: set ts=4 */ |