comparison src/X_main.c @ 1021:4f4abce1b5df refine_backend_if

Move X_main.c to mb_timer_man_t
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 22 Nov 2010 14:02:01 +0800
parents e6c107b2e271
children 63f2f1daf5d3
comparison
equal deleted inserted replaced
1020:f25b8ad338b4 1021:4f4abce1b5df
13 #include "mb_shapes.h" 13 #include "mb_shapes.h"
14 #include "mb_redraw_man.h" 14 #include "mb_redraw_man.h"
15 #include "mb_paint.h" 15 #include "mb_paint.h"
16 #include "mb_timer.h" 16 #include "mb_timer.h"
17 #include "mb_animate.h" 17 #include "mb_animate.h"
18 #include "mb_backend_utils.h"
18 19
19 #define OK 0 20 #define OK 0
20 #define ERR -1 21 #define ERR -1
21 22
22 Display *display; 23 Display *display;
134 paint_t *stroke, *text_stroke; 135 paint_t *stroke, *text_stroke;
135 shape_t *text; 136 shape_t *text;
136 grad_stop_t fill3_stops[3]; 137 grad_stop_t fill3_stops[3];
137 mbe_font_face_t *face; 138 mbe_font_face_t *face;
138 struct timeval tv; 139 struct timeval tv;
140 mb_timer_man_t *timer_man;
139 mb_tman_t *tman; 141 mb_tman_t *tman;
140 mb_timeval_t mbtv, start, playing; 142 mb_timeval_t mbtv, start, playing;
141 mb_progm_t *progm; 143 mb_progm_t *progm;
142 mb_word_t *word; 144 mb_word_t *word;
143 mb_action_t *act; 145 mb_action_t *act;
205 207
206 rdman_redraw_all(&rdman); 208 rdman_redraw_all(&rdman);
207 209
208 XFlush(display); 210 XFlush(display);
209 211
210 tman = mb_tman_new(); 212 timer_man = mb_timer_man_new(&tman_timer_factory);
211 if(tman) { 213 if(timer_man) {
214 tman = mb_tman_new();
215
212 /* Prepare an animation program. */ 216 /* Prepare an animation program. */
213 progm = mb_progm_new(30, &rdman); 217 progm = mb_progm_new(30, &rdman);
214 218
215 MB_TIMEVAL_SET(&start, 0, 0); 219 MB_TIMEVAL_SET(&start, 0, 0);
216 MB_TIMEVAL_SET(&playing, 1, 0); 220 MB_TIMEVAL_SET(&playing, 1, 0);
398 act = mb_visibility_new(VIS_VISIBLE, coord3, word); 402 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
399 403
400 /* Start playing the program. */ 404 /* Start playing the program. */
401 gettimeofday(&tv, NULL); 405 gettimeofday(&tv, NULL);
402 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); 406 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec);
403 mb_progm_start(progm, tman, &mbtv); 407 mb_progm_start(progm, timer_man, &mbtv);
404 408
405 handle_connection(display, tman, &rdman, w, h); 409 handle_connection(display, tman, &rdman, w, h);
406 410
407 mb_progm_free(progm); 411 mb_progm_free(progm);
408 mb_tman_free(tman); 412 mb_timer_man_free(&tman_timer_factory, timer_man);
409 } 413 }
410 414
411 rdman_paint_free(&rdman, fill1); 415 rdman_paint_free(&rdman, fill1);
412 rdman_paint_free(&rdman, fill2); 416 rdman_paint_free(&rdman, fill2);
413 rdman_paint_free(&rdman, stroke); 417 rdman_paint_free(&rdman, stroke);