I`m trying to print a array in allegro with this code:
for (i=0;i<LINES;i++){
for (j=0;j<COLUMS;j++){
if (maze[i][j] == '*')
draw_sprite(labirinto,parede,j*20,i*20);
else if (maze[i][j] == 's')
draw_sprite (labirinto,saida,j*20,i*20);
else if (maze [i][j] == ' ')
draw_sprite(labirinto,chao,j*20,i*20);
}
}
draw_sprite (buffer,labirinto,0,0);
draw_sprite (screen,buffer,0,0);
it was working for lines = 30 , colums = 30 , but when i changed to 30 lines and 40 colums it only render a 30x30.
if this helps :
BITMAP *buffer = create_bitmap(LINES*20,COLUMS*20);
BITMAP *labirinto = create_bitmap(LINES*20,COLUMS*20);
each bitmap "saida" "chao" "parede" have 20 x 20 px
https://prnt.sc/k1dn5r -> print of the image result. (theres no interference with next drawnings , only that doesnt work
if this helps :
BITMAP *buffer = create_bitmap(LINES*20,COLUMS*20); BITMAP *labirinto = create_bitmap(LINES*20,COLUMS*20);
You should swap LINES and COLUMS there. They are backwards.
BITMAP* buffer = create_bitmap(COLUMNS*20 , LINES*20); BITMAP* labirinto = create_bitmap(COLUMNS*20 , LINES*20);