Confusion about Game Editor with MFC

Started by
3 comments, last by Dorvo 18 years, 3 months ago
Hi all, i am confused about how i should do my game editor with MFC (VC++) and DirectX. I want it to display always only one map (indication for SDI) but with several tool windows for picking tiles/objects. DirectX should render the map to the main window (parent) and objects in the toolwindows (children). Questions: 1.) Should a toolwindow be a CDialog or CFormView derived class if i need to render within it? 2.) Can i render in a picture box of a CDialog object? 3.) Is it necessary to use an MDI app? 4.) Is it possible to render in the client area of a MDI Mainframe ? 5.) Rendering to multiple targets/windows should be done with swap chains ? Thanks for any help
Advertisement
1) From my experience, a modeless CDialog derived tool window works very well.
2) Yes, you can render into any control and a picture box is just as good as a static control.
3) No, it's neither necessary nor suitable unless you want to edit many maps at once. Please note that SDI still allows for multiple views, though.
4) Yes it's possible to render into the client area.
5) Rendering into multiple windows should (must?) be implemented using swap chains.

HTH,
Pat.
It's possible to use an SDI setup for the editor; but, there will be a few things you need to worry about. For instance, if you create a toolbar along either side of the main window, and you draw to the client area of the main window, you will be rendering over top of the toolbar. Your best bet would be to go with an MDI setup, just to save from that hassle (and it can be quite so).

If you're going to be using DirectX in multiple windows (e.g. A map editor window, and another window), then you'll need to look into swap chains. I've never used them, so I can't say too much about the process of setting them up. Are you planning on having each object in its own picture box? If so, that swap chain would be massive.

For MDI setups, it would be better to create a CChildFrame window and render into that, for your map editing. As for rendering into a picture box, it's doable. Personally, to save from the complexity of that added rendering, I would set the toolbars up to have tree views of the objects, instead of rendering meshes. This way, people will lower-end video cards and systems wouldn't be lagging when they scroll through the list of objects available. To add to this, you could set it up so if the user double-clicked on one of the tree nodes (objects), then a little model viewer could open up with the mesh of the selected object.
Thx both for your help.

Have to think abit more about it though.

P.S.:
Quote:
4) Yes it's possible to render into the client area.


I tried this once but got problems with the toolbar drawing and the usually used OnDraw-Handler for Rendering which isn't present in FrameWnd.
Here's an article on CodeProject about using DirectX with MFC. It might give you some ideas to get you started.

This topic is closed to new replies.

Advertisement