home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////////
- // Game Programming All In One, Third Edition
- // Chapter 19 - PlayFlick
- //////////////////////////////////////////////////////
-
- #include <stdio.h>
- #include "allegro.h"
-
- #define WHITE makecol(255,255,255)
-
- int fli_callback(void)
- {
- //display some info after each frame
- textprintf_ex(screen, font, 0, 0, WHITE,0,
- "FLI resolution: %d x %d", fli_bitmap->w, fli_bitmap->h);
- textprintf_ex(screen, font, 0, 10, WHITE,0,
- "Current frame: %2d", fli_frame);
-
- //ESC key stops animation
- if (keypressed())
- return 1;
- else
- return 0;
- }
-
- int main(void)
- {
- //initialize Allegro
- allegro_init();
- set_color_depth(16);
- set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
- install_timer();
- install_keyboard();
-
- //play fli with callback
- play_fli("particles.fli", screen, 1, fli_callback);
-
- //time to leave
- allegro_exit();
- return 0;
- }
- END_OF_MAIN()
-