🔒 Locked
DirectDraw Clippers
Advertisement
Original Post
How do i setup the region data struct that is needed to set the clip list for a DirectDraw clipper?
I want to setup a clipper to clip the whole of my backbuffer surface (in fullscreen mode) but i''m not sure how to setup the region data struct properly.
Is it just me.. Or does noone here know anything about DirectDraw? I don''t think i''ve ever had a DirectDraw related question answered here. Why doesn''t anyone know about DirectDraw? Does anyone even know it exists?
AFAIK (I''ve not used DirectDraw for 5 years!), clipper objects are NOT supported in fullscreen mode!.
If your app is running in windowed mode, then the setup is roughly (from looking at my archive of game code I wrote back then):
// create clipper and assign it to our window
// with the size being the same as the window
DirectDrawCreateClipper( 0, &lpDDCClipper, NULL );
lpDDCClipper->SetHWnd( 0, hWndDevice );
// attach clipper to primary surface/swap chain
lpDDSPrimary->SetClipper( lpDDCClipper );
Simon O''Connor
Game Programmer &
Microsoft DirectX MVP
If your app is running in windowed mode, then the setup is roughly (from looking at my archive of game code I wrote back then):
// create clipper and assign it to our window
// with the size being the same as the window
DirectDrawCreateClipper( 0, &lpDDCClipper, NULL );
lpDDCClipper->SetHWnd( 0, hWndDevice );
// attach clipper to primary surface/swap chain
lpDDSPrimary->SetClipper( lpDDCClipper );
Simon O''Connor
Game Programmer &
Microsoft DirectX MVP
Tricks of the windows game programming gurus? That book sounds pretty good, i''ll see if i can scrape some money together and buy a copy 
In my program the mouse is used to move the center point of an object around the screen and when the screen is redrawn the object is drawn centered on that point.
If the edge of the object goes off the screen then my program locks up and turns nasty on me sometimes requiring me to use the reset button of my computer.
Someone suggested i use a clipper object and the SetClipList method to set a rectangle the size of the screen to be clipped and then i attach that to my backbuffer. My problem is i''m not sure exactly how to setup the RGNDATA struct which is required by the SetClipList method.
Thanks
In my program the mouse is used to move the center point of an object around the screen and when the screen is redrawn the object is drawn centered on that point.
If the edge of the object goes off the screen then my program locks up and turns nasty on me sometimes requiring me to use the reset button of my computer.
Someone suggested i use a clipper object and the SetClipList method to set a rectangle the size of the screen to be clipped and then i attach that to my backbuffer. My problem is i''m not sure exactly how to setup the RGNDATA struct which is required by the SetClipList method.
Thanks
Re: S1CA.
Umm...I''m currently writing a game using DirectX 7( that had the last true interface of DirectDraw ) and its running in Full screen mode using clippers.
The only limitation with the clipper is that it only works with the "Blt" method but not the "BltFast" method.
We''ll let you off this time as its been 5 years for you!
Re: DarkEvilOne.
With that sorted out - use the Blt command if you want to use supported clippers. If you use BltFast - you have to write your own rectangle clipper.
Which isn''t too difficult if you think it out throughly first. Before you make your call to BltFast - you want a function you can call to take the blitting rectangle and do the appropriate adjustments...
Good luck!
Umm...I''m currently writing a game using DirectX 7( that had the last true interface of DirectDraw ) and its running in Full screen mode using clippers.
The only limitation with the clipper is that it only works with the "Blt" method but not the "BltFast" method.
We''ll let you off this time as its been 5 years for you!
Re: DarkEvilOne.
With that sorted out - use the Blt command if you want to use supported clippers. If you use BltFast - you have to write your own rectangle clipper.
Which isn''t too difficult if you think it out throughly first. Before you make your call to BltFast - you want a function you can call to take the blitting rectangle and do the appropriate adjustments...
Good luck!
Yeah i know BltFast doesn''t support clippers.
I found a way around my problem. Instead of setting up the RGNDATA struct myself i''ve found out that theres some Windows API functions to do it for me. First i have to call CreateRectRgn() to create a HRGN object. Then i call GetRegionData() on that HRGN object to get the RGNDATA struct. I can''t try this out right now but it should work
Thanks
I found a way around my problem. Instead of setting up the RGNDATA struct myself i''ve found out that theres some Windows API functions to do it for me. First i have to call CreateRectRgn() to create a HRGN object. Then i call GetRegionData() on that HRGN object to get the RGNDATA struct. I can''t try this out right now but it should work
Thanks
quote:
Original post by Anri
Re: S1CA.
Umm...I''m currently writing a game using DirectX 7( that had the last true interface of DirectDraw ) and its running in Full screen mode using clippers.
The only limitation with the clipper is that it only works with the "Blt" method but not the "BltFast" method.
We''ll let you off this time as its been 5 years for you!
quote:
Original post by DarkEvilOne
Is it just me.. Or does noone here know anything about DirectDraw? I don''t think i''ve ever had a DirectDraw related question answered here. Why doesn''t anyone know about DirectDraw? Does anyone even know it exists?
Direct Draw isn''t really supported any more, you are supposed to use D3D in 2D mode. My game is using DirectDraw so I am in the same boat as you
Yeah i know DirectDraw went out when DirectX8 came out and that people have started using Direct3D for 2D work. I''ve tried playing with Direct3D but all this stuff about matrices and camera/screen/world transformations etc just goes way over my head. So i''m going to stick to DirectDraw for now
I''ll learn D3D eventually i just need to keep trying to understand it till it gets into my head.
Does anyone know what to do with the Buffer member of the windows RGNDATA struct? In the help file i''ve got it says this about it..
Buffer is a single byte and i need to store 16 bytes there so i''m guessing i would need to allocate memory or something? And if i have to allocate memory then how do i go about doing that? Buffer can''t be assigned to the new memory location because it''s a constant pointer.
Damn the windows API can be evil.
Does anyone know what to do with the Buffer member of the windows RGNDATA struct? In the help file i''ve got it says this about it..
typedef struct _RGNDATA { // rgnd
RGNDATAHEADER rdh;
char Buffer[1];
} RGNDATA;
Buffer
Specifies an arbitrary-size buffer that contains the RECT structures that make up the region.
Buffer is a single byte and i need to store 16 bytes there so i''m guessing i would need to allocate memory or something? And if i have to allocate memory then how do i go about doing that? Buffer can''t be assigned to the new memory location because it''s a constant pointer.
Damn the windows API can be evil.
Hmm, ok sorry ignore that last post 
I just had an idea. I created a new struct like so:
It''s the same as the windows RGNDATA struct except i use a RECT where RGNDATA uses a char for the Buffer member. Then i simply cast it when i pass it to GetRegionData() and IDirectDrawClipper.SetClipList().
I run some tests to make sure all the functions i used were returning ok and i also tested the clipper by drawing a rectangle off the bottom and right edges of the backbuffer and drawing it to the screen and everything went fine.
Thanks anyway!
I just had an idea. I created a new struct like so:
struct MyRgn
{
RGNDATAHEADER rdh;
RECT Buffer[1];
};
It''s the same as the windows RGNDATA struct except i use a RECT where RGNDATA uses a char for the Buffer member. Then i simply cast it when i pass it to GetRegionData() and IDirectDrawClipper.SetClipList().
I run some tests to make sure all the functions i used were returning ok and i also tested the clipper by drawing a rectangle off the bottom and right edges of the backbuffer and drawing it to the screen and everything went fine.
Thanks anyway!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement