Archived

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

KartalTr

working with DirectDrawClipper.

Recommended Posts

Hi. I''m trying to use DirectDrawClipper but i can''t I look Ms DX SDK help but it is''nt help me. I want to clip an offscreen surface. I''m drawing sprites to this surface and it''s size 400x300. I could''nt find any sample about it. Thanks for any help. Kartal

Share this post


Link to post
Share on other sites
Hi,

are you sure you want to do this ? When using a DirectClipper you can''t use any FastBlt calls. And normally you can do clipping yourself. And telling DirectClipper to actually clip is real pain. Anyway if you want it I can look for some example code. But I can''t promise anything

[ Ampaze | turbo.gamedev.net ]

Share this post


Link to post
Share on other sites

yes i know about this pain But i''m planning to control DDERR_BLTFASTCANTCLIP message for bltfast and if i get this error message i''ll use blt command.
And the other way is clipping myself. I''m tried but i couldn''t. I solve clipping problem for mouse pointer(Surface) with this code.
SetRect(SrcRect, 0, 0, 32, 48);
if CursorPos.x > 768 then SetRect(SrcRect, 0, 0, 32 - ((CursorPos.x + 32) - 800), 48);
if CursorPos.y > 552 then SetRect(SrcRect, 0, 0, 32, 48 - ((CursorPos.y + 48) - 600));
MakeItSo( FBackSurface.BltFast(CursorPos.x, CursorPos.y, MPointer, @SrcRect, DDBLTFAST_SRCCOLORKEY or DDBLTFAST_WAIT) );
I tried to use this way for the problem. I couldn''t again

I want it because of i draw panels one time and after i draw them only when mouse is over and panels need refresh, so i have more FPS(like 30 to 57). Game area can be scrolled. So that when the sprites pass the game area, they drawing on to panels. I want to prevent it. I tried to draw them on to game area surface but when i do that it needs to clear. But when i do that i lost surface picture. So i must draw game area surfaces(sprites, etc.) to backsurface.


Thank you Ampaze.

Regards.
Kartal

Share this post


Link to post
Share on other sites
OH NO !!!

I can't find the clipper-cliplist-code I once wrote !!
BUT it must be there !
Guess I have to rewrite it ... damn !

Isn't it possible that you draw those panels last ?
Because if you would use a clipper you'd have to specify where it is allowed to draw, as this is only possible with rects, that would be a lot of work.
The SDK says :
quote:

The IDirectDrawSurface7::Blt method copies data only to rectangles in the clip list. For instance, if the upper-right quarter of a surface was excluded by the rectangles in the clip list, and an application blitted to the entire area of the clipped surface, DirectDraw would effectively perform two blits, the first being to the upper-left corner of the surface, and the second being to the bottom half of the surface, as shown in the following diagram.



As I said I can't find the delphi-code for that, I will see if I can find some time do redo it.

Good luck !

Edited by - Ampaze on June 14, 2000 3:34:32 PM

Share this post


Link to post
Share on other sites
hi

I draw panel(which have buttons, listbox, etc..) only when it needs refresh(mouse is over or something change on it). And with this method i have more FPS (like 30 before this method, 57 FPS after). i don''t use any clear surface method. So directx carry on to draw them. Therefore i must control objects which are on the game area. Because of prevent to draw on panels. So i want to control them in the game are. Screen size 800x600. and game area size is 500x400. I don''t use clipper because it''s so slow. I''m trying to use new method. I''m trying to change object''s Rect.

Thanks.
Regards
Kartal

Share this post


Link to post
Share on other sites
Actually the method Kartal uses is the right one, although he should be drawing panels on both surfaces so that when they''re flipped - there''ll be no strange behavior (assuming he''s using double or triple buffering).
Using Clipper is also a good idea. On my machines, FastBlt seems to work (?) with clipper. To use it, create an instance of it, assign it to the surface and put the necessary rectangles of clipping area - it''ll do the rest.

- Arcane Lifepower -

"Although the world would call me free
Each day the more her slave am I
For in her very way to be
There''s I don''t know what, I don''t know why"

Share this post


Link to post
Share on other sites