user3422550
user3422550

Reputation: 1

Allegro 5 Drawing at wrong time

I'm having a problem with drawing in Allgero 5 using c++. I draw the bitmaps the do the transformations then use the transformations and flip the buffers but when I turn the FPS cap down I see that it first draws everything the applies the transformations instead of doing it all in one frame.

This is the drawing code:

update(timePast, keyState, &X, &Y, &PDX, &PDY, &ChangeInX, &ChangeInY, &radian);


al_draw_scaled_bitmap(background, 0, 0, 300, 225, -ScreenWidth / 2, -ScreenHeight / 2, ScreenWidth, ScreenHeight, NULL);     
al_draw_rotated_bitmap(player, 18, 23, PDX, PDY, radian, NULL);


al_identity_transform(&camera);    
al_translate_transform(&camera, -PDX, -PDY);
al_rotate_transform(&camera, -radian);
al_translate_transform(&camera, ScreenWidth / 2, ScreenHeight * 0.7);



al_use_transform(&camera);  
al_flip_display();  
al_clear_to_color(al_map_rgb(0,0,0));

I can't figure it out, any help would be much appreciated thanks.

Upvotes: 0

Views: 153

Answers (1)

Matthew
Matthew

Reputation: 48294

al_use_transform() affects drawing operations that are called after it.

al_flip_display() is not a drawing operation, it simply makes the backbuffer visible.

Upvotes: 1

Related Questions