Sign in to follow this  

Controls on a form

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

My game editor will need several areas to be rendered with DirectX (map view, sprite library etc.) My question is: If I make each view as a custom control capable of drawing itself (I work with C#) do I need to create a separate DirectX Device for each? A Device needs to be associated with one window, right? How is such an application structured and are there other issues compared to working with full screen mode? Thanks for any help.

Share this post


Link to post
Share on other sites
Quote:
do I need to create a separate DirectX Device for each?

Unless all of your controls are linked together by some "super" control then you'll need a device for each. It's been a while since I did much work with this (and even then, it wasn't in C#) I seem to remember you could create your additional viewports as extra swap chains and point them at different hDC/hWnd's..

BUT, I'm pretty sure that a windowed-mode D3D session is supposed to be able to co-exist with other windowed mode D3D appplications; so if you did have 4 viewport controls each with their own device then you should be okay. Obviously, you won't be able to share geometry/textures between them - which would be a bit rubbish if they're just multiple views of the same models..

---------EDIT---------------

Just had a quick look in my managed docs based on my previous code. You want to look into the SwapChain class. Looks to me like you can create multiple swapchains from a device and present parameters. If you use common settings for PresentParameters, but accordingly alter the PresentParameters.DeviceWindow Property to point at your multiple controls you should be getting what you want.

----------------------------

hth
Jack

Share this post


Link to post
Share on other sites
I don't really need multiple views of the same scene, the way I imagined it, each control would display different content. This is for a 2D game so there is only one view...

I'll just try to describe what I want...
For the map editor, I need one control to show a view of the 2D map that is being assembled, and another control to list the available sprites/game objects to put in the map. So the scene displayed by this control would be all available sprite images listed horizontally, with arrows scrolling the view.

I need other editors as well, but from what you say it seems that I should just create one device for each of my controls. Thanks for your help.

Share this post


Link to post
Share on other sites
Quote:
Original post by happysad
each control would display different content.

This will make your life a whole lot easier!

Quote:
For the map editor, I need one control to show a view of the 2D map that is being assembled, and another control to list the available sprites/game objects to put in the map. So the scene displayed by this control would be all available sprite images listed horizontally, with arrows scrolling the view.

Right, well in truth, I wrote a lot of editors in previous years and I think you're going overkill here.

Quite simply, your main scene might appreciate DirectX, but the "sprite images listed horizontally" - why do they need DirectX? I'm pretty damn sure the regular .NET API can handle that sufficiently..

Quote:
I should just create one device for each of my controls.

If you don't need to share any resources between the devices, then yes. If your design fits the right pattern and you can generalise things into many instances of the same control then you should be fine [smile].

hth
Jack

Share this post


Link to post
Share on other sites

This topic is 4688 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this