Thread: Allegro and blit()

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    75

    Angry 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-->

    Code:
    blit(welcome, screen,0,0,(SCREEN_W-welcome->w)/2, (SCREEN_H-welcome->h)/2, welcome->w, welcome->h);
    Allegro docs are lousy, where can I get a tutorial or more info on the allegro functions??

    Thanx!!
    ---Programming is like roaming, you never know where you'll end at------

    If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??

    [email protected]

  2. #2
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Code:
    void blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
    I'm going to go step by step so you understand each term perfectly.

    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. allegro, small problem
    By IM back! in forum C++ Programming
    Replies: 8
    Last Post: 11-20-2008, 02:29 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  3. textprintf - how to blit it?
    By GaPe in forum Game Programming
    Replies: 5
    Last Post: 05-04-2003, 03:22 AM
  4. draw to a BITMAP* argument - allegro and objects again
    By MadHatter in forum Game Programming
    Replies: 13
    Last Post: 12-13-2002, 06:51 AM
  5. My Allegro Program will not run...
    By Vicious in forum Game Programming
    Replies: 17
    Last Post: 06-14-2002, 12:49 AM