Jump to content
  • Advertisement

Archived

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

wah_on_2

How to display GDI under full screen mode?

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

I have another question about display GDI under full screen mode I have two buttons in a window, i want to display those under fullscreen mode:
  
MyButton button1 = new MyButton(....);  //<- This is button class that i made using CreateWindow("Button".....)

MyButton button2 = new MyButton(....);
pDD->CreateClipper(0, &ddClipper, NULL);
ddClipper->SetHWnd(0, hWnd);
pDD->FlipToGDISurface();
void TimerDraw()  //<- this function for timer to call

{
    lpPrimary->SetClipper(ddClipper);
    lpPrimary->Blt(NULL, lpBackBuffer, NULL, DDBLT_WAIT, NULL);
}  
  
i set a timer and it will call TimerDraw function to display content at each second. However, the button can only display one times and then never display. Why? And how can i solve it?

Share this post


Link to post
Share on other sites
Advertisement
I don''t believe GDI anything really works with DirectDraw in full screen mode - well not that I''ve ever had any sucess but at the end of the day I''ve never really wanted a GDI button in my nice apps anyway - they''re not exactly asthetically pleasing.

I would assume it doesn''t work being as DirectDraw most likely is not going to use GDI in anyway, probably won''t handle to the drawing of objects being as GDI is slow and DirectDraw is fast.

Well - it''s a guess anyway. Try drawing your own buttons and use DirectInput for your mouse which is really easy.

Hope this helps a bit.

~~tim

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You probably already know this, but if you look at the direct draw examples that come with version 8/8.1 SDK then you should see one example that deals with these kinds of issues...

Kind regards,
Kevin

Share this post


Link to post
Share on other sites
No, actually you can use GDI in DirectDraw - quite easily. Of course, I''ve not used DirectX since version 5, but I don''t think anything has changed! GDI can be useful for drawing text on the screen, and other simple non-speed imperative operations.

Share this post


Link to post
Share on other sites
Are you using a back buffer? You should create a back buffer and dump your stuff on it first. I have noticed that stuff ''vanished'' if I directly used the front buffer.

Share this post


Link to post
Share on other sites
Are we talking GDI functions or buttons here?

I knew you could use GDI for writing out text and whatever but as for having GDI buttons (i.e. push button thingys like in all the apps) then surely that in effect means having another window on top of the fullscreen directdraw which wouldn''t work because it''s exclusive or something like that?

~~tim

Share this post


Link to post
Share on other sites
gdi and dx work fine together, its just that the gdi does not know dx is there so it tends to need some coaxing to redraw it self. you can use updatewindow() after a call to invalidaterect() after you update the screen (since again dx does not tell the gdi it has invalidated what the gdi drew). the gdi is not slow, and in windowed mode is just as fast as directdraw when doing per pixel operations.

ussually mixing the gdi and dx is more trouble then its worth unless its for a simple interface you want up and running fast. in the long run using the gdi will limit your app since you have to ensure that the correct buffer is being shown on screen (thus destroying double buffering).

g_fire_1983 its obvious you dont know much about how the gdi nor dx work. so dont comment with useless information. as long as the created windows are children of the dx window then they will appear above the dx window. also directdraw is not fast nor is the gdi slow. directdraw only allows better and easier control of things like placing buffers in vram instead of letting the drivers pick. in fact if you are doing purly pixel operations (ie custom blits and per pixel effects), directdraw gives little to no speed advantage over the gdi. this is especially true when in windowed mode. in some of mu apps i use the windows popup menu instead of a custom menu since its much quicker and easier to do.

Share this post


Link to post
Share on other sites
Thanks for reply.

However, i still don''t know how to do. Please help.

My situation is:
I created a window with two buttons. I blt a bitmap into the background of the window(No problem occur, all thing can display). However, i found that, the background will become a black block after another window covered it. So i create a timer for redraw the windows at each second.(The problem occur, the button disappear.)

How can i solve? >_< Thanks a lot of.

Share this post


Link to post
Share on other sites
I tried that i can''t display a button in a window using DirectDraw7::FlipToGDISurface().
I read the sample of the DirectX SDK about display Dialog in FullScreen mode.
The sample can work normally(the dialog can display). However, i tried to add a button to the sample program, the button cannot display.

I want to know can i display a button in a window under full screen mode? How can i display button if the answer is yes?

I added this code after the code that is creates dialog.


  
m_ChWnd = CreateWindow("BUTTON", "", WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, 0, 0, 200, 200, hWnd, (HMENU)CntlID, hInst, NULL);



Share this post


Link to post
Share on other sites
after you finish drawing the background you have to InvalidateRect(theButtonHWND) and call UpdateWindow(theButtonHWND) for it to draw properly (at least that is what should work).

also when you draw while the gdi stuff is displayed you should be very careful. you cant double buffer correctly, so you must draw to the backbuffer then blit to the primary buffer then tell the button to redraw. there may be some flicker, unfortunatly i dont have the time currently to create a project and test some theroies that may get rid of the flicker (like having the buttons draw to a buffer you specify by sending the WM_PAINT message)

[edited by - a person on April 21, 2002 6:59:54 PM]

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!