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()

what is the size of aground.bmp?

50 pixels by 50 pixels.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.