Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Clearing the Screen


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 pizza box   Members   -  Reputation: 168

Like
Likes
Like

Posted 13 December 2001 - 01:02 PM

I''m programming a tetris-style game using Window''s GDI. Every time I draw a rectangle it stays on the screen when I draw the next one, so I would leave a trail of rectangles whenever I moved the block. To solve this, I drew a big black rectangle the size of the screen to clear it before drawing the next frame, but I was wondering if there was a faster way to clear the screen, or perhaps a function that I could use? Thanks

Sponsor:

#2 Badone   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:06 PM

Have you tried just drawing a black box over the tetris box? So you can use the same code that you used to draw the box but with black instead of your color.

#3 Floppy   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:15 PM

Are you double buffering?

#4 pizza box   Members   -  Reputation: 168

Like
Likes
Like

Posted 13 December 2001 - 01:16 PM

Thats what Ive been doing, but the box I draw is the entire screen so it clears out everything. The problem is that I can see the blocks flickering, so it is kind of slow. I was wondering if there are any built-in functions to solve this.

#5 Dharma   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:20 PM

You dont have to draw a black box over the entire screen. Just a black one on same place and same size but black... Or double buffer. (drawing everything on a invisible area then copy it all to the screen.

/Mario

Mvh Mario..

Edited by - Dharma on December 13, 2001 8:21:03 PM

#6 Floppy   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:21 PM

What API are you in? Doing double buffering by putting a black square over the screen is not double buffering. OpenGL uses this:
  
// Swap the buffers (double-buffering)

SwapBuffers(window->hDC);


#7 Dharma   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:23 PM

If you will stick to using GDI... Below you have a link describing this.

http://www.winprog.org/tutorial/references.html

Mvh Mario..

#8 atcdevil   Members   -  Reputation: 145

Like
Likes
Like

Posted 13 December 2001 - 01:24 PM

Hey, try the function BitBlt

#9 Dharma   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 December 2001 - 01:27 PM

Sorry bad link.. this should work fine

http://www.winprog.org/tutorial-old/

Mvh Mario..

#10 pizza box   Members   -  Reputation: 168

Like
Likes
Like

Posted 13 December 2001 - 01:44 PM

Thanks for the link. I wasn''t double buffering before, I had a late post. Hopefully things will run a little smoother now. Thanks




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS