How to implement a a draw batch in allegro 5
dhia hassen

I told you that im thinking in migrating my game engine from SDL2/SDL_gpu to allegro 5 , but one among other things that im worrying about is that sdl_gpu supports a very easy to use draw batch , while i can't see anything simular in allegro 5 or im i wrong ? anyway , i also wanted to ask , how to do 2D accelerated graphics with thousands os sprites to draw per frame ? so those are my tow questions :) thanks

i think it is something like :
al_hold_bitmap_drawing(true);
for (int y = 0; y != Vertical_Block_count; y++)
for (int x = 0; x != Horizontal_Block_count; x++)
al_draw_bitmap_region(Bitmap, Sprite_Selected * BlockSize, BlockSize * sprites_on_sprite_sheet, BlockSize, BlockSize, x * 16 - 16, y * 16 -16, 0);
al_hold_bitmap_drawing(false);
al_flip_display();

jmasterx

Yes, that is exactly how you do it. You avoid texture switches.

Edgar Reynaldo

Try to keep all of your image resources on the same bitmap and use a texture atlas. This way when you hold drawing, it won't switch the bound texture on you.

Thread #616522. Printed from Allegro.cc