Thanks for the help on the other topic. At the moment my background scrolls smoothly and at a good pace when the program first runs but after it's been running for a few seconds the scrolling slows right down and jerks.
case ALLEGRO_EVENT_TIMER: if(Top_BD.Waiting() == 0) { Top_BD.Update_Position(); } redraw = true; break;
I wanted to make sure the position of the backdrop gets updated once per clock tick so Update_Position sets a variable 'waiting' and doesn't update the position again until
Top_BD.Draw draws the bitmap and set 'waiting' back to 0.
Like I say, suddenly the scrolling slows right down and don't what's causing it.
Perhaps someone could see why ? Thanks.
You're creating new bitmaps every time you call the Draw function...?
No, they're just pointers to ALLEGRO_BITMAPS.
That would have explained it.
EDIT : at the point when it slows right down, the memory usage goes from 4% to 40+%
- from which I conclude that the CPU gets busy which is why it's slowing.
EDIT 2
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
25.00 0.03 0.03 dinkle_pixels_from_tiles
25.00 0.06 0.03 next_to_two_array_code
16.67 0.08 0.02 dinkle_make_monochrome_pattern
8.33 0.09 0.01 arrays_are_the_same
8.33 0.10 0.01 make_another_line
8.33 0.11 0.01 next_to_array_code
8.33 0.12 0.01 reflect_tile