• Advertisement


This topic is now archived and is closed to further replies.

Can anyone with experiance using allegro help??

This topic is 6215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, Ive been using allegro for a short time now and one thing thats bugging the hell out of my and cant seem to find a solution to is the strange thing that happens when i draw bitmaps to the screen...The first bitmap comes out fine..but every other bitmap after that''s color is all distorted...I will include a short source (50 lines or so) to see what if you can spot what im doing wrong,it''d be ideal if you could edit this source so that it will work properly and not only display the 1st image correctly and post it up so i can see the error of my ways Note: all bitmaps loaded into WizardSprite are 256 color ****************Begin source******************* #include BITMAP *DoubleBuffer; BITMAP *WizardSprite; RGB pal[256]; int PosX,PosY; void main(void) { allegro_init(); install_timer(); install_keyboard(); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); DoubleBuffer=(create_bitmap(640,480)); WizardSprite=load_bmp("wizlookdown.bmp",pal); PosX = (SCREEN_W - WizardSprite->w)/2; PosY = (SCREEN_H - WizardSprite->h)/2; set_palette(pal); set_color_depth(8); /* The Main Loop,The first Bitmap loaded into WizardSprite Comes out fine,however any Bitmap after that comes out different colors than they ought to be.*/ while (!key[KEY_ESC]) { clear_to_color(DoubleBuffer,115); draw_sprite(DoubleBuffer,WizardSprite,PosX,PosY); blit(DoubleBuffer,screen,0,0,0,0, DoubleBuffer->w, DoubleBuffer->h); if( (key[ KEY_LEFT]) && (PosX > 0) ) { WizardSprite=load_bmp("wizlookleft.bmp",pal); PosX--; } if( (key[ KEY_RIGHT]) && (PosX + WizardSprite->w < SCREEN_W) ) { WizardSprite=load_bmp("wizlookright.bmp",pal); PosX++; } if( (key[ KEY_UP]) && (PosY > 0) ) { WizardSprite=load_bmp("wizlookup.bmp",pal); PosY--; } if( (key[ KEY_DOWN]) && (PosY + WizardSprite->h < SCREEN_H) ) { WizardSprite=load_bmp("wizlookdown.bmp",pal); PosY++; } } destroy_bitmap(WizardSprite); destroy_bitmap(DoubleBuffer); allegro_exit(); } **************************** Yesterday we Obeyed kings & bent our necks before emperors,but today we kneel only to the truth. ****************************

Share this post

Link to post
Share on other sites

  • Advertisement