Robię sobie program w którym ma zostać wyświetlona animacja.
"Wystąpił problem z aplikacją xxxxx.exe i zostanie ona zamknięta. Przepraszamy za kłopoty."
Wiec bardzo proszę o pomoc.
#include <allegro.h>
int main()
{
allegro_init();
install_keyboard();
set_color_depth( 32 );
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0 );
BITMAP * bufor = NULL;
BITMAP * ludek0 = NULL;
BITMAP * ludek1 = NULL;
BITMAP * ludek2 = NULL;
BITMAP * ludek3 = NULL;
BITMAP * ludek4 = NULL;
BITMAP * ludek5 = NULL;
BITMAP * ludek6 = NULL;
BITMAP * ludek7 = NULL;
BITMAP * ludek8 = NULL;
BITMAP * ludek9 = NULL;
BITMAP * ludek10 = NULL;
bufor = create_bitmap( 1024, 768 );
if( !bufor )
{
set_gfx_mode( GFX_TEXT, 0, 0, 0, 0 );
allegro_message( "Nie mogę utworzyć bufora !" );
allegro_exit();
return 0;
}
ludek0 = load_bmp( "SCE100.bmp", default_palette );
ludek1 = load_bmp( "SCE101.bmp", default_palette );
ludek2 = load_bmp( "SCE102.bmp", default_palette );
ludek3 = load_bmp( "SCE103.bmp", default_palette );
ludek4 = load_bmp( "SCE104.bmp", default_palette );
ludek5 = load_bmp( "SCE105.bmp", default_palette );
ludek6 = load_bmp( "SCE106.bmp", default_palette );
ludek7 = load_bmp( "SCE107.bmp", default_palette );
ludek8 = load_bmp( "SCE108.bmp", default_palette );
ludek9 = load_bmp( "SCE109.bmp", default_palette );
ludek10 = load_bmp( "SCE110.bmp", default_palette );
int ludek_x = 0, ludek_y = 300;
int frame = 0;
while( !key[ KEY_ESC ] ) {
if( frame > 220 ) frame = 0;
clear_to_color( bufor, makecol( 150, 150, 150 ) );
if( frame < 20 ) { draw_sprite( bufor, ludek0, ludek_x, ludek_y ); }
else if( frame >= 20 && frame < 40 ) { draw_sprite( bufor, ludek1, ludek_x, ludek_y ); }
else if( frame >= 40 && frame < 60 ) { draw_sprite( bufor, ludek2, ludek_x, ludek_y ); }
else if( frame >= 60 && frame < 80 ) { draw_sprite( bufor, ludek3, ludek_x, ludek_y ); }
else if( frame >= 80 && frame < 100 ) { draw_sprite( bufor, ludek4, ludek_x, ludek_y ); }
else if( frame >= 100 && frame < 120 ) { draw_sprite( bufor, ludek5, ludek_x, ludek_y ); }
else if( frame >= 120 && frame < 140 ) { draw_sprite( bufor, ludek6, ludek_x, ludek_y ); }
else if( frame >= 140 && frame < 160 ) { draw_sprite( bufor, ludek7, ludek_x, ludek_y ); }
else if( frame >= 160 && frame < 180 ) { draw_sprite( bufor, ludek8, ludek_x, ludek_y ); }
else if( frame >= 180 && frame < 200 ) { draw_sprite( bufor, ludek9, ludek_x, ludek_y ); }
else if( frame >= 200 && frame < 220 ) { draw_sprite( bufor, ludek10, ludek_x, ludek_y ); }
blit( bufor, screen, 0, 0, 0, 0, 1024, 768 );
}
destroy_bitmap( ludek0 );
destroy_bitmap( ludek1 );
destroy_bitmap( ludek2 );
destroy_bitmap( ludek3 );
destroy_bitmap( ludek4 );
destroy_bitmap( ludek5 );
destroy_bitmap( ludek6 );
destroy_bitmap( ludek7 );
destroy_bitmap( ludek8 );
destroy_bitmap( ludek9 );
destroy_bitmap( ludek10 );
destroy_bitmap( bufor );
allegro_exit();
return 0;
}
END_OF_MAIN();
A jeszcze jedno pytanie czy da się zamieścić plik .piv Bo mam zamiar zrobić super animacje składającą się z większej liczby klatek ??