Jump to content
  • Advertisement

Archived

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

JSCFaith

How do I create and use a clipper?

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

Hey Well I have been trying forever to use a clipper, and instead of asking whats wrong with my code, could someone just tell me how the hell im supposed to create and use a clipper. I need to use a clipper so that I can have ships slowly move off the screen, I want to be able to only see half of the ship while the other is off the screen but I cant get this to work because when I try to use Blt to blt a sprite I get invalid rect.Well if anyone could help me get a clipper to work, I would like that, thanks. James, later

Share this post


Link to post
Share on other sites
Advertisement
what I would do to make things easy, (I''m like that) is to test where the x and y of your sprite is located. if you''re sprite needs to be partially clipped, then use the directx blit+clipping function. ala blt. if it''s not even viewable, don''t draw it, and if it''s viewable and not clipped, then use bltfast.

JoeMont001@aol.com www.polarisoft.n3.net

Share this post


Link to post
Share on other sites
Here''s some code for that:

    LPDIRECTDRAWCLIPPER   clipper;
//Create the clipper for our window

if( FAILED( lpdd4->CreateClipper(0, &clipper, NULL)))
Error("Couldn''t create the clipper");

//Set the window the clipper shold be attached to

if( FAILED( clipper->SetHWnd(0, hwnd)))
Error("Couldn''t set the clipper to the window handle");

//Set the clipper to the primary surface

if( FAILED( lpddssecondary->SetClipper(clipper)))
Error("Couldn''t set the clipper to the primary surface");

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!