Allegro and blit()
How can I make that an bitmap image blits on the screen and fills ALL the screen, not just the center?
I use blit() for that, but the BITMAP(welcome) only fills half the screen, so how do I have to use blit() to make the bitmap welcome fill the whole screen??
That only fills the center of the screen with welcome.bmp-->
Allegro docs are lousy, where can I get a tutorial or more info on the allegro functions??
blit(welcome, screen,0,0,(SCREEN_W-welcome->w)/2, (SCREEN_H-welcome->h)/2, welcome->w, welcome->h);
I'm going to go step by step so you understand each term perfectly.:)
void blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
BITMAP *source = the file name of the bitmap you want to blit to another bitmap...in your case "welcome"
BITMAP *dest = the file name of the bitmap you want the source bitmap to be blitted to...you should blit welcome to a buffer then blit the buffer to the screen. this will prevent flickering.
int source_x = the x coordinate from the source bitmap that you want to start copying from. more often that not that will be 0
int source_y = the same as int source_y except for the y coordinate
int dest_x = the spot where you want the source bitmap to be blitted to. if you want the bitmap to fill the whole buffer then you would again go with 0
int dest_y = the samething as int dest_x except with the y coordinate
int width = the width of the screen, so use SCREEN_W
int height = the height of the screen, so use SCREEN_H
now to show you how you would fill the screen up with the bitmap "welcome" (remember welcome is going to have to be the same size as the screen and if it's not you're going to have to look into stretched_blit() )
blit(welcome, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
there you go. just to let you know, this site > allegro.cc < is the primary site for allegro users.
btw, the allegro docs are not lousy. in fact they are very informative.