pokulan Temat założony przez niniejszego użytkownika |
Menu w Allegro C++ » 2013-11-23 11:24:34 Mam problem, jestem początkujący (zarówno w C++ jak i Allegro) chciałbym zrobić menu do mojej gry, ale nie wiem jak (strzałka w górę podświetla napis wyżej, strzałka w dół podświetla napis niżej). Póki co mam tyle: #include <allegro.h> BITMAP * bufor = NULL; int mki = 1; int menuKI() { if( key[ KEY_UP ] && mki > 1 ) mki = mki - 1; if( key[ KEY_DOWN ] && mki < 3 ) mki = mki + 1; return( mki ); }
void menu() { bufor = create_bitmap( 640, 480 ); clear_to_color( bufor, makecol( 0, 64, 255 ) ); int menuK = menuKI(); if( menuK = 1 ) { textout_ex( bufor, font, "GAJ!", 300, 200, makecol( 0, 0, 0 ), makecol( 255, 0, 0 ) ); textout_ex( bufor, font, "INFORMACJE", 277, 230, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); textout_ex( bufor, font, "WYJSCIE :(", 277, 260, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); } else if( menuK = 2 ) { textout_ex( bufor, font, "GAJ!", 300, 200, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); textout_ex( bufor, font, "INFORMACJE", 277, 230, makecol( 0, 0, 0 ), makecol( 255, 0, 0 ) ); textout_ex( bufor, font, "WYJSCIE :(", 277, 260, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); } else if( menuK = 3 ) { textout_ex( bufor, font, "GAJ!", 300, 200, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); textout_ex( bufor, font, "INFORMACJE", 277, 230, makecol( 0, 0, 0 ), makecol( 255, 255, 255 ) ); textout_ex( bufor, font, "WYJSCIE :(", 277, 260, makecol( 0, 0, 0 ), makecol( 255, 0, 0 ) ); } blit( bufor, screen, 0, 0, 0, 0, 640, 480 ); }
int main() { allegro_init(); install_keyboard(); set_color_depth( 32 ); set_gfx_mode( GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0 ); clear_to_color( screen, makecol( 0, 64, 255 ) ); bufor = create_bitmap( 640, 480 ); clear_to_color( bufor, makecol( 0, 64, 255 ) ); menu(); while( !key[ KEY_ESC ] ) { blit( bufor, screen, 0, 0, 0, 0, 640, 480 ); } allegro_exit(); return 0; destroy_bitmap( bufor ); }
END_OF_MAIN();
Niestety klikając na strzałki nic się nie dzieje :( |