I cannot promise that this is the solution, but looking at your code, I don't understand why you are creating multiple buffers.
bufDisplay = al_create_bitmap(WIDTH, HEIGHT);
buffer = al_create_bitmap(WIDTH, HEIGHT);
Unless you are doing some type of special effect that requires buffers, they are unnecessary. Allegro 5 already provides a double buffer with default settings.
Just draw everything to the default target bitmap (the display's back buffer), and then al_flip_display()
.
If you want to center or scale your output to a different sized window, you can usually just use transformations.
I don't know why you are calling Sleep(8)
.
If using Windows, you could switch to using OpenGL (set the ALLEGRO_OPENGL
display flag).
You should try other Allegro games and demos (plenty come with the source) to see if it's a problem on all of them.