Sign in to follow this  

C++ Model with C# View

Recommended Posts

I was thinking about how you'd go about doing this sort of thing in regards to some kind of game editor. Such as having a WPF application with some rich UI, and a center window that would house the rendering, which would be done in unmanaged C++ and directx. Now the way I see it, is that data is going to have to go both ways. Such as - User clicks WPF UI to change some setting (which affects the rendering), which will then need to notify the c++ of that setting - User clicks the rendering window, to select say some object in 3d, the C++ code would then need to notify the WPF code, to display a window that shows that objects properties Do you think this could be done by a message system? So rather than a whole host of functions needing to be created to sync the two. Each has a single message loop like a win32 WndProc. But Im then wondering about what happens when you want to pass across a large class. Say for example, again, you wanted to view the objects properties in a WPF dialog when the object is selected in the view port, and makes a change. For this to happen, its going to need to; - C++ detect viewport has been clicked - C++ traces and selects the object from the scene - C++ Marshalls all object data and sends message to WPF - WPF recieves message, and creates window with data - User makes a change in that dialog - WPF sends message back to C++ of change - C++ recieves message and makes change Now, how should the data be passed? If I pass a pointer, thats going to cause all sorts of issues. Could a WPF application even make use of a pointer from c++ code that was of a polymorphic type? I gather that Multiple inheritance would be out of the question. So Im thinking I would just pass the data by value as a struct. Any advice on this kind of thing?

Share this post

Link to post
Share on other sites

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