Jump to content

Recommended Posts

Posted

Boas pessoal.

Depois de compilar este código aparece me uma janela a dizer que exec. deixou de funcionar, e penso que o código esta correcto. O que estou a fazer mal??  😄

#include <allegro.h>
#define MAX 800
#define MAY 600


int main()
{
   allegro_init();
   install_keyboard();
   set_color_depth(32);
   set_gfx_mode(GFX_AUTODETECT_WINDOWED, MAX,MAY,0,0);
   /*logo do P@P em bitmap*/
     BITMAP *PAP;//bitmap que vai carregar a imagem
     BITMAP *tela;//bitmap que finge de tela principal(para impedir que os objetos pisquem
     PAP=create_bitmap(800,600);
     PAP=load_bitmap("C:\Documents and Settings\Administrador\Desktop\imagem.bmp", NULL); 
   while(!key[KEY_ESC])
        {     
           draw_sprite(tela,PAP,0,0);//pinta no bitmap tela a imagem PAP na posição 0,0
           blit(tela,screen,0,0,0,0,SCREEN_W,SCREEN_H);
        }
        return 0;
}
END_OF_MAIN();
Posted

não sou versado em allegro, mas isto não pode estar bem :

     BITMAP *tela;//bitmap que finge de tela principal(para impedir que os objetos pisquem
     PAP=create_bitmap(800,600);
     PAP=load_bitmap("C:\Documents and Settings\Administrador\Desktop\imagem.bmp", NULL); 
   while(!key[KEY_ESC])
        {     
           draw_sprite(tela,PAP,0,0);//pinta no bitmap tela a imagem PAP na posição 0,0
           blit(tela,screen,0,0,0,0,SCREEN_W,SCREEN_H);

não existe nenhuma atribuição à variável tela ...

IRC : sim, é algo que ainda existe >> #p@p
Posted

mr desculpa eu é que te dei isso mal  :nono:

tens de meter tela=create_bitmap(800,600); em ves de PAP=create_bitmap(800,600);

desculpa novamente  😁

#include <allegro.h>
#define MAX 800
#define MAY 600


int main()
{
   allegro_init();
   install_keyboard();
   set_color_depth(32);
   set_gfx_mode(GFX_AUTODETECT_WINDOWED, MAX,MAY,0,0);
   /*logo do P@P em bitmap*/
     BITMAP *PAP;//bitmap que vai carregar a imagem
     BITMAP *tela;//bitmap que finge de tela principal(para impedir que os objetos pisquem
     tela=create_bitmap(800,600);
     PAP=load_bitmap("C:\Documents and Settings\Administrador\Desktop\imagem.bmp", NULL); 
   while(!key[KEY_ESC])
        {     
           draw_sprite(tela,PAP,0,0);//pinta no bitmap tela a imagem PAP na posição 0,0
           blit(tela,screen,0,0,0,0,SCREEN_W,SCREEN_H);
        }
        return 0;
}
END_OF_MAIN();

se voltar a dar erro é porque n encontra a imagem!

ou é porque a imagem não é .bmp!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.