Mercurial > MadButterfly
comparison src/X_main.c @ 42:e3295c07faa9
mb_shift is work
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 09 Aug 2008 08:06:45 +0800 |
parents | 400b4b5db0dc |
children | 7d9af44f095b |
comparison
equal
deleted
inserted
replaced
41:400b4b5db0dc | 42:e3295c07faa9 |
---|---|
10 #include <string.h> | 10 #include <string.h> |
11 #include "shapes.h" | 11 #include "shapes.h" |
12 #include "redraw_man.h" | 12 #include "redraw_man.h" |
13 #include "paint.h" | 13 #include "paint.h" |
14 #include "mb_timer.h" | 14 #include "mb_timer.h" |
15 #include "animate.h" | |
15 | 16 |
16 #define OK 0 | 17 #define OK 0 |
17 #define ERR -1 | 18 #define ERR -1 |
18 | 19 |
19 Display *display; | 20 Display *display; |
125 perror("gettimeofday"); | 126 perror("gettimeofday"); |
126 return; | 127 return; |
127 } | 128 } |
128 MB_TIMEVAL_SET(&mb_tmo, tmo.tv_sec, tmo.tv_usec); | 129 MB_TIMEVAL_SET(&mb_tmo, tmo.tv_sec, tmo.tv_usec); |
129 mb_tman_handle_timeout(tman, &mb_tmo); | 130 mb_tman_handle_timeout(tman, &mb_tmo); |
131 rdman_redraw_changed(rdman); | |
130 XFlush(display); | 132 XFlush(display); |
131 } else if(FD_ISSET(xcon, &rds)) { | 133 } else if(FD_ISSET(xcon, &rds)) { |
132 event_interaction(display, rdman, w, h); | 134 event_interaction(display, rdman, w, h); |
133 } | 135 } |
134 } | 136 } |
146 grad_stop_t fill3_stops[3]; | 148 grad_stop_t fill3_stops[3]; |
147 cairo_font_face_t *face; | 149 cairo_font_face_t *face; |
148 struct test_motion_data mdata; | 150 struct test_motion_data mdata; |
149 struct timeval tv; | 151 struct timeval tv; |
150 mb_tman_t *tman; | 152 mb_tman_t *tman; |
151 mb_timeval_t mbtv; | 153 mb_timeval_t mbtv, start, playing; |
154 mb_progm_t *progm; | |
155 mb_word_t *word; | |
156 mb_action_t *act; | |
152 int i; | 157 int i; |
153 | 158 |
154 tmpsuf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h); | 159 tmpsuf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h); |
155 tmpcr = cairo_create(tmpsuf); | 160 tmpcr = cairo_create(tmpsuf); |
156 | 161 |
294 XFlush(display); | 299 XFlush(display); |
295 } | 300 } |
296 | 301 |
297 tman = mb_tman_new(); | 302 tman = mb_tman_new(); |
298 if(tman) { | 303 if(tman) { |
304 progm = mb_progm_new(2, &rdman); | |
305 | |
306 MB_TIMEVAL_SET(&start, 1, 0); | |
307 MB_TIMEVAL_SET(&playing, 2, 0); | |
308 word = mb_progm_next_word(progm, &start, &playing); | |
309 act = mb_shift_new(0, 20, coord1); | |
310 mb_word_add_action(word, act); | |
311 | |
312 MB_TIMEVAL_SET(&start, 3, 0); | |
313 MB_TIMEVAL_SET(&playing, 2, 0); | |
314 word = mb_progm_next_word(progm, &start, &playing); | |
315 act = mb_shift_new(0, 20, coord2); | |
316 mb_word_add_action(word, act); | |
317 | |
318 gettimeofday(&tv, NULL); | |
319 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); | |
320 mb_progm_start(progm, tman, &mbtv); | |
321 | |
299 mdata.text_stroke = text_stroke; | 322 mdata.text_stroke = text_stroke; |
300 mdata.rdman = &rdman; | 323 mdata.rdman = &rdman; |
301 gettimeofday(&tv, NULL); | 324 gettimeofday(&tv, NULL); |
302 tv.tv_sec += 3; | 325 tv.tv_sec += 3; |
303 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); | 326 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec); |