Skip to main content

History: Mogre MyGUI wrapper

Preview of version: 22

MyGUI_logo.png


With the Mogre MyGUI wrapper it's possible to use the MyGUI system by Mogre.

mstoyke wrote:
I'm currently using a slightly extended version of MyGUI with their C++/CLI wrapper. It's a very good GUI system and the .NET bindings work very well. You can even use their layout editor and use the GUI layouts easily. I'm too busy right now to write detailed instructions on how to get it work but I can offer to post a patch in unified diff format with my changes and some lines of example code.


More information you find at the MyGUI website mygui.info.

Ogre related information you find in the MyGUI forum (section of the Ogre forum).
Related to the Mogre wrapper there is a special forum topic: Managed MyGUI

Info For Mogre related questions you can open a thread in the Mogre forum. Additionally you could invite user mstoyke to answer. (Please don't discuss by message - do it in public so that it helps other people, too.)

Videos




Download


The source code you can get in the download area of the MyGUI website.
The Mogre/.NET wrapper is part of the MyGUI project and can be found in the MyGUI repository.

Additionally look to the binary download section. It contains the Mogre wrapper, dependencies, demos and the layout editor.

I also packed a workable MyGUI wrapper for MOGRE 1.7.1, here is the download link: MediaFire download or you can extract the full MOGRE libraries (including Physx, MyGUI) from my Billardgames: Github Repository

Usage

Tubulii wrote:

I am using MyGui in my mogre app successfully. It wasn't hard, anything you need is here and here(all for Mogre 1.6.5.)
The second one is optional, but there is one file you need: export.vs . This codefile contains some functions to init and destroy MyGui. I never tried to use the MOGREframework in that package, I used the one in the Wiki. Some classes aren't wrapped, but all basic things seams to work fine.
(Quoted from this forum post in January 2010)




First of all, we need to create a class called "Export" which will import some necessary functions from "MyGUI.OgrePlatform.Export.dll"

Copy to clipboard
public class Export { #region Export [DllImport("MyGUI.OgrePlatform.Export.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void Export_CreateGUI(); [DllImport("MyGUI.OgrePlatform.Export.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void Export_DestroyGUI(); [DllImport("MyGUI.OgrePlatform.Export.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void Export_SetRenderWindow([MarshalAs(UnmanagedType.LPStr)] string _name); [DllImport("MyGUI.OgrePlatform.Export.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void Export_SetSceneManager([MarshalAs(UnmanagedType.LPStr)] string _name); [DllImport("MyGUI.OgrePlatform.Export.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void Export_SetActiveViewport(int _index); #endregion public static void CreateGUI() { Export_CreateGUI(); } public static void DestroyGUI() { Export_DestroyGUI(); } public static void SetRenderWindow(RenderWindow _renderWindow) { Export_SetRenderWindow(_renderWindow.Name); } public static void SetSceneManager(SceneManager _sceneManager) { Export_SetSceneManager(_sceneManager.Name); } public static void SetActiveViewport(int _index) { Export_SetActiveViewport(_index); } }



and then, in your ui creation code part, we need to create the GUI firstlty:

Copy to clipboard
Export.CreateGUI(); Export.SetRenderWindow(YourRenderWindowObject); Export.SetSceneManager(YourSceneManager); Export.SetActiveViewport(Viewport ID, set 0 to be a first viewport);



After creating the GUI, you can create any widgets as you want

When you want to destroy the GUI, make sure you use the following code:

Copy to clipboard
Export.DestroyGUI();

Wrapper details


The MyGUI repository has the directory Wrappers. This contains several subdirectories. For some we know the meaning:

  • MyGUI.Export (C++): . . . . Exports all needed functions of the native MyGui
  • MyGUI.Sharp: . . . . A C# Wrapper of MyGui (needs file MyGui.export)
    • The depencies are MyGUIEngine.dll and MyGui.export.dll (and .NET)
    • For Mogre is only an indirect depency: You need Mogre for creating MyGui.export.dll
  • MyGUI.OgrePlatform.Export(C++): . . . . Exports all needed functions of the native MyGui
  • MyGUI.Managed: . . . . A CLI/C++ Wrapper (needs MyGUI.OgrePlatform.Export)


Note:
MyGui.managed and MyGui.sharp seems to be equal. Maybe the C# one is a port of the managed one and not a build from scratch.

The original post from Altren:

Altren wrote:

Hello from MyGUI project! We have implemented generator wrappers for the library. Generator parsed data from doxygen, and with the help of templates, performs the generation of wrappers. At the moment there are templates for C# and Managed C++. It is also possible to setup generator for other languages if the need arises.

1. C# - MyGUI.Export.dll (exported functions) + MyGUI.Sharp.dll (wrapper using P/Invoke)
2. Managed C++ - MyGUI.Managed.dll (wrapper using CLR)
...


Compilation

1. Download MyGUI and compile it with same Ogre version and with same visual studio as Mogre was built with (also MYGUI_BUILD_WRAPPER option in CMake should be enabled). See also http://www.ogre3d.org/tikiwiki/MyGUI+Compiling
2. Compile MyGUI.OgrePlatform.Export(_d).dll
3. Generate Managed wrapper (to do this run WrapperGenerator that comes with MyGUI -> (in app select one by one)Generate Solution, Doxygen, Managed).
4. Compile MyGUI.Managed.dll in newly generated solution.
5. In Mogre add MyGUI.Managed.dll as referecnce
6. Use MyGUI initialisation from MyGUI.OgrePlatform.Export(_d).dll

Whole post: http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=9529

Note: It seems that with .Net 4 the wrapper does not work anymore. The OgrePlattform.Export.dll ist not found (although its in the same directory). An workaround would be to merge it with the main wrapper project and so totally avoid all P/Invoke calls.

See also


MyGUI related:


Common:

History

Information Version
Sun 20 of Nov, 2022 09:01 GMT-0000 randomcode 23
Sun 20 of Nov, 2022 08:59 GMT-0000 randomcode 22
Sun 20 of Nov, 2022 08:57 GMT-0000 randomcode 21
Sun 20 of Nov, 2022 08:55 GMT-0000 randomcode 20
Sun 20 of Nov, 2022 08:50 GMT-0000 randomcode 19
Wed 20 of Nov, 2013 18:47 GMT-0000 Beauty added link to "MyGUI 3.0 for MogreSDK 1.6.5" 18
Sun 16 of Sep, 2012 19:26 GMT-0000 Tubulii Added content of altren's post 17
Sun 16 of Sep, 2012 19:21 GMT-0000 Tubulii Just found altren's post about the wrapper: Added quote and compilation instructions. 16
Thu 20 of Jan, 2011 01:09 GMT-0000 Beauty new section stub "compilation" 15
Wed 19 of Jan, 2011 21:08 GMT-0000 Beauty added Table of Content + moved section "videos" 14
Wed 19 of Jan, 2011 20:56 GMT-0000 Beauty added section "Wrapper details" 13
Tue 18 of Jan, 2011 20:17 GMT-0000 Beauty added section "Usage" 12
Wed 05 of Jan, 2011 13:44 GMT-0000 TeaBag 11
Wed 05 of Jan, 2011 11:54 GMT-0000 Beauty added more details 10
Wed 05 of Jan, 2011 11:33 GMT-0000 Beauty added more details 9
Wed 05 of Jan, 2011 11:08 GMT-0000 Beauty added links to source code 8
Wed 05 of Jan, 2011 11:00 GMT-0000 Beauty tiny change 7
Sat 18 of Dec, 2010 19:24 GMT-0000 Beauty improved link list 6
Sat 18 of Dec, 2010 19:06 GMT-0000 Beauty added links 5
Sat 18 of Dec, 2010 18:45 GMT-0000 Beauty 4
Sat 18 of Dec, 2010 17:58 GMT-0000 Beauty added more content and links 3
Mon 27 of Sep, 2010 22:15 GMT-0000 jacmoe 2
Fri 23 of Jul, 2010 11:40 GMT-0000 Beauty created new page (less content) 1