Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » How to implement a a draw batch in allegro 5

This thread is locked; no one can reply to it. rss feed Print
How to implement a a draw batch in allegro 5
dhia hassen
Member #16,240
March 2016

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
Member #11,410
October 2009

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

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: