0

I'm trying to make a 50x50 board of 50 pixel by 50 pixel squares. However, when I run this code, it only gives me one square. Does anyone have any idea what I'm doing wrong?

#include <iostream>
#include <allegro.h>

using namespace std;
int xgen = 0;
int ygen = 0;
int main(int argc, char *argv[])
{
    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode(GFX_AUTODETECT, 640,480,0,0);
    BITMAP *ground = NULL;
    ground = load_bitmap("aground.bmp", NULL);
    while (xgen < 2501){
           blit(ground, screen, xgen, ygen, 0, 0, 50, 50);
           xgen = xgen + 50;
           if (xgen == 2500 && !ygen == 2500){
                        ygen = ygen + 50;
                        xgen = 0;
                        }}
    readkey();
    destroy_bitmap(ground);
    destroy_bitmap(ground1);
    return 0;
}
END_OF_MAIN()
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by DTV
0

Anyone have an idea? Can you display the same bitmap multiple times?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.