Toggling winforms with MOgre?

Vectrex

18-02-2010 15:11:27

Hi, this is a pretty unusual thing, but is it possible in winforms to toggle on and off the form?
My situation is we've got a unity style game engine/editor going so I'd like the user to be able to swap between the 'real' game and the editor. Since the editor IS the game winforms is really just a glorified property editor.
I guess the easiest way is to keep winforms going and pop the MOgre window out into it's own fullscreen window and hide the main form. I'd prefer a way to disable/delete winforms as I presume it'd sit there eating cpu :) Also how to do the opposite, ie start the normal game and at some stage open the editor without actually stopping the game. I guess I've got a personal hell of handle id's ahead of me? :twisted:

kraj0t

22-02-2010 10:53:07

After reading your post a few times, I'm still not sure what the actual question is.

Are you asking how you should swap from scene to game view? Then it's only a matter of having multiple viewports on multiple forms. I dunno what the problem is.

You seem to be doing just the same that I am, a Unity-like engine/editor. Check it out, I'll be glad to share what I've learned.

Vectrex

22-02-2010 11:36:41

ah hehe, you're doing basically exactly the same thing as me :) Except you're miles ahead! ;)

A few questions
- Are you using MOIS for the input in the scene view? I found it works but it's hard to get right
- What winforms components do you use? I use weifenluo for docking and Aga treeviewAdvanced for the hierarchy tree.
- I see you don't have any unity style drag-dropping. I couldn't get that to work either! :lol:
- Are you using propertyGrid for the properties window? It's good but incomplete
- It looks like you're using reflection instead of propertygrid since you can have public fields editable?
- For saving/prefabs etc are you using C# serialisation or something else?
- How do you get a consistant MOgre window update? I tried Idle and a Timer component but they are random. Do you update separately from winforms?
- Is the editor for a game?

The question about hiding winforms is basically this. If I hide the MainForm, fullscreen the game window and run my own loop, will that run as fast as if I never initiated winforms stuff? If it DOES then can I then do the opposite and show the editor stuff again without stopping the game?

Your editor looks great and obviously you see the coolness of components and C#. Keep us informed :)

kraj0t

22-02-2010 16:11:56

- Are you using MOIS for the input in the scene view? I found it works but it's hard to get right
Yes, and it's really a pain. MOIS will only recognise the top form's handle, so all coordinates for child controls are messed up. I've still have to study this a lot more, though; The way this works is quite pre-alpha right now.

- What winforms components do you use? I use weifenluo for docking and Aga treeviewAdvanced for the hierarchy tree.
I use Weifenluo. Never heard of Aga, but I'll have a look into it.

- Are you using propertyGrid for the properties window? It's good but incomplete
Yes, and it SUCKS. I can't stress how much I hate Microsoft's PropertyGrid control. It represents one of the reasons why I hate .NET so much. Getting to tame it to do what you want is stupidly tough.

- I see you don't have any unity style drag-dropping. I couldn't get that to work either! :lol:
Haven't started to work on it. That's not a major concern for me.

- It looks like you're using reflection instead of propertygrid since you can have public fields editable?
I'm using some code found in Codeproject. I've had to do some modifications to it. Components (and other things that may appear in the property grid) are transformed into GenericPropertis (see previous link) depending on how the game component is designed. There are some abstract classes involved, allowing you to represent components in different ways (compiled, scripted...). Currently only compiled components are implemented.

- For saving/prefabs etc are you using C# serialisation or something else?
The engine supports your own implementations of parsers. Right now it uses XML.

- How do you get a consistant MOgre window update? I tried Idle and a Timer component but they are random. Do you update separately from winforms?
I use a Timer component with a delay of 10. Then I use Monitor.TryEnter() at the timer's event, where the simulation is updated. Could actually do this some other ways, though.

- Is the editor for a game?
Sure. I've managed to attract two friends of mine to join the project. We'll keep you informed, if it lives on enough. I also plan on releasing the editor as opensource and maintaining it, if the community (if any) so wants.

PS: I'm sorry but this must look like a rant about my project, totally out of place. I should get to it and update the wiki of my project, and then write a good post here in Mogre forums... but I'll have to find some time to do that.

kraj0t

22-02-2010 16:16:37

Damn I forgot copying the rest of your post.

The question about hiding winforms is basically this. If I hide the MainForm, fullscreen the game window and run my own loop, will that run as fast as if I never initiated winforms stuff? If it DOES then can I then do the opposite and show the editor stuff again without stopping the game?
I don't think there's much loss in efficiency if you just stop calling your renderwindows' Update() method when one of your windows goes fullscreen. And after all, the editor is supposed to run slowlier than the actual game, isn't it? So I wouldn't worry too much about that.