annotate examples/dynamic/main.c @ 308:9e1d72eca57b

Seperate mb_animated_menu from the demo program
author wycc
date Sun, 22 Feb 2009 11:52:56 +0800
parents a90fd749af82
children 433fa83d16f9
rev   line source
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
1 /*! \file
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
2 *
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
3 * svg2code_ex is an example that show programmers how to create a
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
4 * menu with MadButterfly.
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
5 *
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
6 */
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
7 #include <stdio.h>
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
8 #include <mb.h>
217
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
9 #include <string.h>
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
10 #include "menu.h"
247
d9a78c859660 Seperate the frameowrk codes from the main.c.
wycc
parents: 245
diff changeset
11 #include "mbapp.h"
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
12
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
13
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
14
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
15 typedef struct {
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
16 shape_t *rect;
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
17 co_aix orx,ory;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
18 int start_x,start_y;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
19 observer_t *obs1,*obs2;
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
20 int currentscene;
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
21 }MyAppData;
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
22
217
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
23
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
24 #define CMOUSE(e) (coord_get_mouse_event(e))
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
25
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
26 static void add_rect_move(event_t *evt, void *arg)
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
27 {
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
28 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
29 mouse_event_t *mev = (mouse_event_t *) evt;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
30
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
31 printf("resize rectangle\n");
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
32 sh_rect_set(en->rect, en->start_x, en->start_y, mev->x - en->start_x, mev->y-en->start_y,0,0);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
33 rdman_shape_changed(MBAPP_RDMAN(arg),en->rect);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
34 rdman_redraw_changed(MBAPP_RDMAN(arg));
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
35 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
36
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
37 static void add_rect_release(event_t *evt, void *arg)
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
38 {
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
39 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
40 mouse_event_t *mev = (mouse_event_t *) evt;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
41
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
42 printf("rectangle done\n");
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
43 subject_remove_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), en->obs1);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
44 subject_remove_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), en->obs2);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
45 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
46
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
47 static void add_rect_2(event_t *evt, void *arg)
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
48 {
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
49 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
50 mouse_event_t *mev = (mouse_event_t *) evt;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
51 paint_t *color;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
52
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
53 printf("select first point\n");
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
54 // Add an rect path
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
55
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
56 en->start_x = mev->x;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
57 en->start_y = mev->y;
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
58 subject_remove_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), en->obs1);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
59 subject_remove_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), en->obs2);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
60 en->obs1 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_move, en);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
61 en->obs2 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_BUT_RELEASE, add_rect_release, en);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
62 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
63
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
64 static void add_rect_2_move(event_t *evt, void *arg)
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
65 {
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
66 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
67 mouse_event_t *mev = (mouse_event_t *) evt;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
68
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
69 sh_rect_set(en->rect, mev->x, mev->y, 50,50,0,0);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
70 rdman_shape_changed(MBAPP_RDMAN(arg),en->rect);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
71 rdman_redraw_changed(MBAPP_RDMAN(arg));
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
72 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
73
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
74 static void add_rect(event_t *evt, void *arg)
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
75 {
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
76 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
77 mouse_event_t *mev = (mouse_event_t *) evt;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
78 paint_t *color;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
79
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
80 printf("menut selected\n");
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
81 en->obs1 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_BUT_PRESS, add_rect_2, en);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
82 en->obs2 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_2_move, en);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
83 en->rect = rdman_shape_rect_new(MBAPP_RDMAN(arg), mev->x, mev->y, 50 , 50, 0,0);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
84 // Paint it with color
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
85 en->obs1 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_BUT_PRESS, add_rect_2, en);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
86 en->obs2 = subject_add_event_observer(CMOUSE(MBAPP_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_2_move, en);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
87 en->rect = rdman_shape_rect_new(MBAPP_RDMAN(arg), mev->x, mev->y, 50 , 50, 0,0);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
88 // Paint it with color
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
89 color = rdman_paint_color_new(MBAPP_RDMAN(arg), 0.800000, 0.800000, 0.400000, 1.000000);
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
90 rdman_paint_fill(MBAPP_RDMAN(arg), color, en->rect);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
91 // Add to the stage
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
92 //rdman_add_shape(MBAPP_RDMAN(arg), en->rect, en->menu->root_coord);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
93 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
94
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
95
217
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
96 void test(void *a)
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
97 {
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
98 printf("Button is pressed.....\n");
8d9d717c9300 Add sample code fro mb_button_t. If everything is OK, I will move it to the main src tree.
wycc@wycc-desktop
parents: 201
diff changeset
99 }
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
100
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
101 MBApp *myApp;
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
102
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
103 void switch_scene(const mb_timeval_t *tmo, const mb_timeval_t *now,void *arg)
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
104 {
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
105 MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData );
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
106 mb_timeval_t timer,interval;
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
107
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
108
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
109 get_now(&timer);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
110 MB_TIMEVAL_SET(&interval, 1 ,0);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
111 MB_TIMEVAL_ADD(&timer, &interval);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
112 mb_tman_timeout( MBApp_getTimer(myApp), &timer, switch_scene, myApp);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
113
244
d36abace2ce4 Fix bug in *_goto_scene()
Thinker K.F. Li <thinker@branda.to>
parents: 242
diff changeset
114 en->currentscene = (en->currentscene + 1) % 2;
d36abace2ce4 Fix bug in *_goto_scene()
Thinker K.F. Li <thinker@branda.to>
parents: 242
diff changeset
115 printf("switch to scene %d\n", en->currentscene + 1);
d36abace2ce4 Fix bug in *_goto_scene()
Thinker K.F. Li <thinker@branda.to>
parents: 242
diff changeset
116 MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1);
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
117 }
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
118
249
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
119 MyApp_InitContent()
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
120 {
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
121 mb_button_t *b;
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
122 mb_sprite_t *sprite;
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
123
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
124 sprite = sprite_load("button", myApp->rdman, myApp->rdman->root_coord);
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
125 b = mb_button_new(myApp->rdman, sprite, "btn");
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
126 mb_button_add_onClick(b, test,NULL);
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
127 }
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
128
278
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
129 void draw_text()
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
130 {
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
131
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
132 }
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
133
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
134 int main(int argc, char * const argv[]) {
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
135 subject_t *subject;
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
136 mb_obj_t *button;
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
137 MyAppData data;
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
138 mb_timeval_t tmo,interval;
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
139
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
140 if (argc > 1)
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
141 myApp = MBApp_Init(argv[1]);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
142 else
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
143 myApp = MBApp_Init("scene");
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
144 data.currentscene=0;
278
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 249
diff changeset
145 draw_text();
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
146 MBApp_setData(myApp,&data);
249
ab8284c8dcee * Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman.
wycc
parents: 247
diff changeset
147 MyApp_InitContent();
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
148 get_now(&tmo);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
149 MB_TIMEVAL_SET(&interval, 1 ,0);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
150 mb_tman_timeout( MBApp_getTimer(myApp), &tmo, switch_scene, myApp);
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
151
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
152
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
153 MBApp_loop(myApp);
201
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
154
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
155 return 0;
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
156 }
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
157
31933f9ee70e Chkec in demo for dynamic rectangle creation and button.
wycc@wycc-desktop
parents:
diff changeset
158 /* vim: set ts=4 */