Jump to content
  • Advertisement
Sign in to follow this  
chrpeter

Allegro Question

This topic is 3704 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to make a bouncing pong ball but as it moves it leaves a trail of red: color = makecol(red = 255,green = 0,blue = 0); circlefill(screen, x, y, 20, color); is there any way to delete the old circle then draw the new one to make it so it doesn't leave a trail? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
What is normally done is at the beginning of each frame, you 'clear' the screen with a specific function in your API, or just by drawing a black (or whatever color) rectangle over the entire window. Then you do your drawing over that.

An alternative method, known as 'dirty rectangles' is to draw a black (or whatever color) circle where your old circle was, to 'erase' it, before re-drawing your circle in the new location.

You should use the first method, it's easier, and more commonly used anyway. If your window flickers alot, make sure you use Double Buffering.

Share this post


Link to post
Share on other sites
Quote:
Original post by chrpeter
What's the clear screen command in Allegro?


I believe clear_bitmap(BITMAP *bitmap); or clear_to_color(BITMAP *bitmap, int color); can be used for that. You can also just draw filled rectangle the same size as the bitmap.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!