#### Archived

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

# Directx Question...

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

## Recommended Posts

hey, Well im having a little problem, ok here it goes. Well I create a clipper using CreateClipper() and then I set it to the primary surface using SetHWnd(). Ok then I wanted to see if it worked so I made a small program that moved a box around the screen, but whenever I get to the edge of the screen it gets stuck, when I got ride of the clipper it was fine, but I would get an invalid rect when I went of the screen, thats because there is no clipper, what should I do different to get the clipper to work? Here is how I create the clipper and set it to the primary surface:
  lpDD->CreateClipper(0, &lpddclipper, NULL); lpddclipper->SetHWnd(0, hwnd); 
Should I do it a different way or someting? I need a clipper becasue im trying to create a strategy game, and if I dont have a clipper I won't be able to get my tile engine work, Well if anyone could help me I would appreciate it, Thanks James, Later Edited by - JSCFaith on 7/16/00 5:34:30 PM

##### Share on other sites
This is the code I use to set up a clipper (I''m using DX 7)

  ClipMinX = 0;ClipMaxX = ScreenWidth - 1;ClipMinY = 0;ClipMaxY = ScreenHeight - 1;// Setup a clipper for the backbuffer/windowRECT ScreenRect = {0,0,ScreenWidth,ScreenHeight};Clipper = AttachClipper(BBuffer,1,&ScreenRect);

I don''t know if this will help or not.

##### Share on other sites
You should set it to the primary surface using IDirectSurface3->SetClipper().

Also, I believe the proper order to iniitalize & attach clippers is:

1. Set coöperative level [ must be before 2 ]
2. Create Clipper [ must be after 1 and before 3 ]
3. Create primary surface [ must be after 2 ]
4. Attach clipper to surface

Greetings, CondorWitte.

• 45
• 11
• 17
• 11
• 13