OSA_PL Temat założony przez niniejszego użytkownika |
[Allegro, C++] Program wyłącza się przy wciśnięciu klawisza 'ESC' » 2010-06-21 12:59:14 Mam problem. Mój program wyłącza się przy wciśnięciu klawisza ESC chociaż nie powinien. #include <allegro.h> #include <winalleg.h> #include <windows.h> #include <conio.h> #include <iostream> using namespace std; int main() { allegro_init(); install_keyboard(); set_color_depth( 32 ); set_gfx_mode( GFX_AUTODETECT_FULLSCREEN, 300, 350, 0, 0 ); FONT * myfont; myfont = load_font( "godz.pcx", default_palette, NULL ); BITMAP * buffer = create_bitmap( 300, 350 ); BITMAP * tarcza = NULL; BITMAP * strzalka = NULL; BITMAP * strzalka1 = NULL; BITMAP * strzalka2 = NULL; tarcza = load_bmp( "tarcza.bmp", default_palette ); strzalka = load_bmp( "sek.bmp", default_palette ); strzalka1 = load_bmp( "strzalka4.bmp", default_palette ); strzalka2 = load_bmp( "strzalka6.bmp", default_palette ); clear_to_color( buffer, 0x333333 ); SYSTEMTIME st; int l = 0; while( true ) { GetLocalTime( & st ); clear_to_color( buffer, 0x333333 ); draw_sprite( buffer, tarcza, 0, 0 ); rectfill( buffer, 0, 300, 300, 350, makecol( 255, 255, 255 ) ); rectfill( buffer, 0, 0, 70, 30, makecol( 22, 22, 254 ) ); rect( buffer, 0, 0, 70, 30, makecol( 253, 248, 23 ) ); rect( buffer, 1, 1, 69, 29, makecol( 29, 253, 23 ) ); rect( buffer, 2, 2, 68, 28, makecol( 22, 231, 254 ) ); rect( buffer, - 1, - 1, 71, 31, makecol( 255, 21, 21 ) ); textprintf_ex( buffer, font, 4, 12, makecol( 250, 182, 22 ), - 1, " OSA_PL" ); if( st.wSecond < 10 && st.wMinute > 9 ) { textprintf_ex( buffer, myfont, 15, 290, makecol( 0, 0, 0 ), - 1, "%d:%d:0%d", st.wHour, st.wMinute, st.wSecond ); } if( st.wSecond < 10 && st.wMinute < 10 ) { textprintf_ex( buffer, myfont, 15, 290, makecol( 0, 0, 0 ), - 1, "%d:0%d:0%d", st.wHour, st.wMinute, st.wSecond ); } if( st.wMinute < 10 && st.wSecond > 9 ) { textprintf_ex( buffer, myfont, 15, 290, makecol( 0, 0, 0 ), - 1, "%d:0%d:%d", st.wHour, st.wMinute, st.wSecond ); } if( st.wSecond > 9 && st.wMinute > 9 ) { textprintf_ex( buffer, myfont, 15, 290, makecol( 0, 0, 0 ), - 1, "%d:%d:%d", st.wHour, st.wMinute, st.wSecond ); } float kat; float kat2; float kat3; kat = st.wSecond; kat2 = st.wMinute; kat3 = st.wHour; if( st.wHour > 12 ) { rotate_sprite( buffer, strzalka1, 136, 74, ftofix(( kat3 - 12 ) / 12 * 256 +( kat2 / 60 * 256 / 12 ) +( kat / 60 * 256 / 60 / 12 ) ) ); } else { rotate_sprite( buffer, strzalka1, 136, 74, ftofix( kat3 / 12 * 256 +( kat2 / 60 * 256 / 12 ) +( kat / 60 * 256 / 60 / 12 ) ) ); } rotate_sprite( buffer, strzalka2, 141, 36, ftofix( kat2 / 60 * 256 +( kat / 60 * 256 / 60 ) ) ); rotate_sprite( buffer, strzalka, 143, 35, ftofix( kat / 60 * 256 ) ); blit( buffer, screen, 0, 0, 0, 0, 640, 700 ); } destroy_bitmap( buffer ); destroy_bitmap( tarcza ); destroy_bitmap( strzalka ); destroy_bitmap( strzalka1 ); destroy_bitmap( strzalka2 ); allegro_exit(); return 0; } END_OF_MAIN();
Proszę o pomoc. |