annotate examples/dynamic/main.c @ 1110:851a062368bd

Change signature of mbe_win_surface_create() by using format argument
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 08 Dec 2010 18:31:39 +0800
parents 36a63287e1d4
children
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>
387
433fa83d16f9 Corrected build dependence - able to build in Ubuntu Intrepid
Ben Lau <xbenlau@gmail.com>
parents: 278
diff changeset
10 //#include "menu.h"
456
26c302b47de1 Change name of header files.
Thinker K.F. Li <thinker@branda.to>
parents: 454
diff changeset
11 #include "mb_af.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;
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
21 } app_data_t;
240
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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
28 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
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);
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
33 rdman_shape_changed(MBAF_RDMAN(arg),en->rect);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
34 rdman_redraw_changed(MBAF_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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
39 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
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");
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
43 subject_remove_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), en->obs1);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
44 subject_remove_observer(CMOUSE(MBAF_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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
49 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
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;
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
58 subject_remove_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), en->obs1);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
59 subject_remove_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), en->obs2);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
60 en->obs1 = subject_add_event_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_move, en);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
61 en->obs2 = subject_add_event_observer(CMOUSE(MBAF_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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
66 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
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);
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
70 rdman_shape_changed(MBAF_RDMAN(arg),en->rect);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
71 rdman_redraw_changed(MBAF_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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
76 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
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");
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
81 en->obs1 = subject_add_event_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), EVT_MOUSE_BUT_PRESS, add_rect_2, en);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
82 en->obs2 = subject_add_event_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_2_move, en);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
83 en->rect = rdman_shape_rect_new(MBAF_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
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
85 en->obs1 = subject_add_event_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), EVT_MOUSE_BUT_PRESS, add_rect_2, en);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
86 en->obs2 = subject_add_event_observer(CMOUSE(MBAF_RDMAN(arg)->root_coord), EVT_MOUSE_MOVE, add_rect_2_move, en);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
87 en->rect = rdman_shape_rect_new(MBAF_RDMAN(arg), mev->x, mev->y, 50 , 50, 0,0);
240
d347a577a232 Rewrite the example by using the MBApp API.
wycc
parents: 230
diff changeset
88 // Paint it with color
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
89 color = rdman_paint_color_new(MBAF_RDMAN(arg), 0.800000, 0.800000, 0.400000, 1.000000);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
90 rdman_paint_fill(MBAF_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
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
92 //rdman_add_shape(MBAF_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
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
101 mbaf_t *app;
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 {
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
105 app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t );
242
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);
1030
36a63287e1d4 Migrate examples/dynamic to new definition of backend
Thinker K.F. Li <thinker@codemud.net>
parents: 456
diff changeset
112 mb_timer_man_timeout( mbaf_get_timer(app), &timer, switch_scene, app);
242
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);
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
116 MB_SPRITE_GOTO_SCENE(app->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
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
124 sprite = sprite_load("button", app->rdman, app->rdman->root_coord);
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
125 b = mb_button_new(app->rdman, sprite, "btn");
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
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;
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
137 app_data_t 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)
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
141 app = mbaf_init(argv[1], "");
242
d3fe0a0f3a8b Implement MBApp API and modify the dynamic example to use this API.
wycc
parents: 240
diff changeset
142 else
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
143 app = mbaf_init("scene", ".libs");
242
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();
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
146 mbaf_set_data(app,&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);
1030
36a63287e1d4 Migrate examples/dynamic to new definition of backend
Thinker K.F. Li <thinker@codemud.net>
parents: 456
diff changeset
150 mb_timer_man_timeout( mbaf_get_timer(app), &tmo, switch_scene, app);
242
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
454
9b8dda201ccb Make naming convention consistent with MadButterfly.
Thinker K.F. Li <thinker@branda.to>
parents: 453
diff changeset
153 mbaf_loop(app);
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 */