开发者

How to add statusbar correctly?

Currently it is floating on top of my rendered window, i dont think thats good for few reasons: 1) i waste rendering time for rendering stuff that isnt visible. 2) it must be rendered every frame again when i wouldnt be updating the whole statusbar every frame anyways.

So how i could create a window where it leaves space for my statusbar and none of my OpenGL stuff could be rendered in that area?

At this moment i just adjust my vi开发者_运维问答ewports in a way that creates empty space for statusbar, but it causes some problems in my current way of doing things. i would have to make my code look much more messier to make it work.


http://www.gamedev.net/community/forums/topic.asp?topic_id=291682

Edit: Its not a simple question to answer. If you don't know what a child window is under Win32 then you may be in a much better position. However asking someone to give you a full explanation of the windows windowing system is no mean feat.

Here is an overview:

Basically you need to create a child window which can be done using CreateWindow to create a window with the WS_CHILD style and with its hWndParent parameter set to the window handle you want the new window to be a child of.

When you created the window you will have, necessarily, create a window procedure When you call DispatchMessage from your message pump (The Loop that does a Get/PeekMessage and then dispatches the messages is the message pump). Inside the window procedure you can then switch on the message type and handle each message sent to your window.

From here you can handle things like setup. Your initial window will have either a WM_CREATE or a WM_INITDIALOG (Depending on what type of window you create). It is from there that you need to create the child windows (Don't forget to call ShowWindow to make them visible!!). From this point you can then set up the DirectX device to be attached to the child window handle (HWND).

Furthermore if you want to be able to re-size the window then you ALSO need to take into account the WM_SIZE mesage. However I'd strongly recommend trying to get the rest working before even beginning to look into this as it gets very complicated as you will need to destroy and re-create your DirectX device so that it is the right size.

Anyway thats just a simple overview. I hope it helps!


One way may be to make your "rendered window" and "statusbar" both children of a containing window, and to add some code for the WM_SIZE message for that containing window to position the children so they don't overlap.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜