el_pango
Member
Hi all,
I'm not sure how many people here use Allegro, as it seems to be less popular than SDL, but if you are using it or working on porting an older full-screen app that 'expects' 320x240 and ran into performance issues with stretch_blit(), this might be of use to you.
When I initialize my app, I do this:
This gives us a -fast- full-screen mode to work with.
I'm not sure how many people here use Allegro, as it seems to be less popular than SDL, but if you are using it or working on porting an older full-screen app that 'expects' 320x240 and ran into performance issues with stretch_blit(), this might be of use to you.
When I initialize my app, I do this:
Code:
int fbdev;
void * scrn_ptr;
BITMAP *double_buffer;
//--------- setup ----------------------------//
// set allegro's internal state up
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,400,240,0,0);
// prepare the pandora's hardware framebuffer for use
system("ofbset -fb /dev/fb1 -pos 0 0 -size 800 480 -mem 192000 -en 1 ");
system("fbset -fb /dev/fb1 -g 400 240 400 240 16");
fbdev = open("/dev/fb1", O_RDWR);
scrn_ptr = mmap(0,400 * 240 * 2, PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, 0);
double_buffer = create_system_bitmap(screen->w, screen->h);
//--------- after drawing to double_buffer ---------//
// copy from our buffer to hardware framebuffer
unsigned long src_px_addr = double_buffer->line[0];
src_px_addr = bmp_read_line(double_buffer,0);
memmove(scrn_ptr, src_px_addr, 400*240*2);
//-------- on app exit --------------------//
munmap(scrn_ptr, 400*240*2);
close(fbdev);
system("ofbset -fb /dev/fb1 -pos 0 0 -size 0 0 -mem 0 -en 0");
This gives us a -fast- full-screen mode to work with.