Jump to content
  • Advertisement
Sign in to follow this  
skied

How Do I Lock the Client Area using Direct Draw?

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

Hi Friends, This is my first post here so forgive me if I'm unfamiliar with some things. Could someone tell me if it is possible I lock the client screen in windowed mode when using DirectDraw? I just tried it but it seems that it does not work since there is a clear screen blink whenever I do that. Thanks in advance for your answer. // edit - added the title [Edited by - LessBread on August 29, 2005 12:33:05 PM]

Share this post


Link to post
Share on other sites
Advertisement
Hey buddy, welcome here. I'm new here too. :)
I cannot understand what you exactly mean. Do you mean that you wanna draw something on a windowed app? In that case just create some objects and present it on your client rect. That's it.
Would you mind posting your codes here? Maybe we can find some clues from them.

Share this post


Link to post
Share on other sites
Thanks for your answer. I want to draw two animated objects (sprit) on
client screen, but I observe a clear screen blink, specially when they hit
each others, there is a big screen blink. Intersting is that when I change
the "window style" to FullScreen Mode (WS_POPUP) instead of Windowed Mode
(WS_OVERLAPPEDWINDOW), the problem misteriously disapears.

Here I have written a simple code to show you that video buffer overwriting
gives me a screen blink while I have lock the client screen already.



{
LPDIRECTDRAWSURFACE lpddsprimary = NULL;
DDSURFACEDESC2 ddsd;
RECT client;
UCHAR *primary_buffer;

GetWindowRect(hwnd,&client);
memset(&ddsd,0,sizeof(ddsd));ddstruct.dwSize=sizeof(ddsd);
lpddsprimary->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,NULL);
primary_buffer=(UCHAR*)ddsd.lpSurface;
Draw_a_fullGreenScreen(); // function defined somewhere else
Draw_a_fullRedScreen(); // function defined somewhere else
lpddsprimary->Unlock(NULL);
}

Share this post


Link to post
Share on other sites
By "screen blink" do you mean it flickers? Or it just blinks and does not draw anything?

If it's just flickering, you'll want to create another directdraw surface, draw to that, then copy the whole thing at once to the primary surface. I'm sure you can find out all you need if you look up "double-buffering."

Share this post


Link to post
Share on other sites
From the code I posted, I expected I'll have a full red screen.
If I call that procedure only one time, everything is ok,
but when I call it frequently several times per second, the client area
flickers which cause me to believe that the client area is not locked at the
time of writing to video buffer.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!