Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a game with Allegro 5 that has a loop. I'd like to make the program write onto the screen, how much time the loop has ended. These are the rounds of a turn-based game, obviously. I use the al_draw_textf function for it, which works perfectly, but I put it into the loop. Its consequence is obviously that the number is written on the same place all the time.

To prevent it, I should delete it at the beginning of every loop. Sadly, I couldn't find any functions in Allegro Manual that does it. How can I do that then?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Typically, you would do a Clear Screen before starting your subsequent Draws, otherwise all your drawings would remain on screen and overlap.

With Allegro, you will need to clear the bitmap you are drawing to before you draw to the screen. I haven't used Allegro in a very long time, so I may be wrong about this.

share|improve this answer
    
I've never used bitmaps in Allegro, my game contains only rectangles with different colours - yet. Anyway, I can't use al_clear_to_color, because I defined most of the graphic elements before the loop begins, and when it starts, the mentioned function clears the already defined elements. Also, I don't want to redraw every elements in every rounds, because that'd make the program way too slow. –  Zoltán Schmidt May 23 '13 at 14:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.