12/02/12 19:33
tola22
salve a tutti ho iniziato ad usare la libreria ALLEGRO ma mi sono bloccato al punto che alla pressione dei tasti direzionali il player anziké fare la mossa che dovrebbe sta li immobile qualcuno mi sa aiutare? ora vi metto il codice che o scritto:
#include <allegro.h> int main() { allegro_init(); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0); BITMAP *my_pic = NULL; my_pic = load_bitmap("picture.bmp", NULL); // Load our picture masked_blit(my_pic, screen, 0,0,0,0,1024,768);//Draw the whole bitmap to the screen at (0,0) clear_keybuf(); clear_bitmap(screen); draw_sprite(screen, my_pic, 0,0); //Draw the bitmap at 0,0. BITMAP *my_pic2 = NULL; my_pic2 = load_bitmap("versione.bmp", NULL); // Load our picture masked_blit(my_pic2, screen, 880,710,0,0,1024,768);//Draw the whole bitmap to the screen at (0,0) draw_sprite(screen, my_pic2, 880,710); //Draw the bitmap at 0,0. BITMAP *my_pic3 = load_bitmap ("player.bmp",NULL) ; int x = 0; int y = 0; while (! key [KEY_ESC]) { if (key [KEY_LEFT]) x -= 5 ; if (key [KEY_RIGHT]) x += 5 ; if (key [KEY_UP]) y -= 5 ; if (key [KEY_DOWN]) y += 5 ; draw_sprite(screen, my_pic3, 550,440); blit (my_pic3, screen, 550, 440, 0, 0, my_pic3->w, my_pic3->h) ; } destroy_bitmap (my_pic); destroy_bitmap (my_pic2); destroy_bitmap (my_pic3); return 0; } END_OF_MAIN ();grazie in anticipo a tutti
aaa