Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How to divide the display

This thread is locked; no one can reply to it. rss feed Print
How to divide the display
nghoangtu
Member #17,135
October 2019

I have the code which draws a bitmap on the display window (480x640), and I want to add a background image which divides the display into multiple squares (32x32 each). Should I use al_draw_bitmap for every square? Or al_draw_bitmap with for loop?

Mark Oates
Member #1,146
March 2001
avatar

Are you making like a background tile map, and you want to draw all the tiles like mario?

nghoangtu
Member #17,135
October 2019

Just the background sir

MikiZX
Member #17,092
June 2019

Using for loop should be easier to write. So instead of writing 300 times al_draw_bitmap it is better to use 'for' loop - that is what they exist for (to automate repetitive tasks).

Go to: