Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

constans

To clip or not to clip?

This topic is 5330 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

Let''s consider that I have cube which moves on the screen. No collision detection, so if it goes off-screen it returns back from the other side. Like this:
// Check if cube passed border

// Passed left or right border
if(cube.x_right < 0)
{
	cube.x_left = SCREEN_WIDTH;
	cube.x_right = cube.x_left + cube.width;
}
else if(cube.x_left > SCREEN_WIDTH)
{
	cube.x_right = 0;
	cube.x_left = cube.x_right - cube.width;
}

// Passed upper or bottom border
if(cube.y_bottom < 0)
{
	cube.y_top = SCREEN_HEIGHT;
	cube.y_bottom = cube.y_top + cube.height;
}
else if(cube.y_top > SCREEN_HEIGHT)
{
	cube.y_bottom = 0;
	cube.y_top = cube.y_bottom - cube.height;
}
And my question is that should I clip the part which is out of sight? Or is it ok without clipping?

Share this post


Link to post
Share on other sites
Advertisement
What if I'm using DirectDraw's blitting function and simple rect which I fill with color? Therefore I'm not using loaded bitmap.

[edited by - constans on January 15, 2004 11:02:21 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!