MQuickGUI        

QuickGUI_Logo.png

About

MQuickGUI is a -GUI system for Mogre. It's a port of an older version of QuickGUI (0.9.5v2).

The current version is working but still needs some adjustment.

Please report Bugs & Feature's Request in the MOGRE Add-On forum.

Note: It's outdated!

The last update was in 2007. If somebody wants to use it, the code have to be updated. (please give us the updated code)

  • Button
  • CheckBox
  • ComboBox
  • Console
  • Image
  • Label
  • LabelArea
  • List
  • LabelMenu
  • NStateButton
  • Panel
  • ProgressBar
  • Sheet
  • TextBox
  • Vertical/Horizontal TrackBar
  • Vertical/Horizontal ScrollBar
  • Window (with TitleBar)

Download

The source code can be found here: http://mogre.svn.sourceforge.net/viewvc/mogre/trunk/MQuickGUI

Setup

First of all, notice that the current MQuickGUI version still uses materials. In QuickGUI version 0.9.6 this has been changed.
To set up a -GUI you have add a set of skin images to your resources. The images itself can be found in the zipped file of the C++ version located in the folder bin/media/skins/qgui/.

In your resources.cfg you have to tell Ogre to load the skin. Add a line like that (the path has to be adjusted to your resources-folder!).
FileSystem=C:/OgreSDK/media/skins/qgui

To get Ogre to find the images like "qgui.window" you have to add a file named "qgui.material" to your qgui-skins folder. This file describes the images you want to use. When initializing your resource groups it will also be loaded. Important note: The following code part only covers the controls Window and Button! To use the other controls like combobox etc. you need to add their descriptions to the qgui.material file. It's just copy & paste with changing names.

TODO: This code part should be made complete and downloadable.

material qgui.pointer
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.pointer.png
         }
      }
   }
}
material qgui.panel
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.panel.png
         }
      }
   }
}
material qgui.window
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.png
         }
      }
   }
}
material qgui.window.titlebar
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.titlebar.png
         }
      }
   }
}
material qgui.window.titlebar.button
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.titlebar.button.png
         }
      }
   }
}
material qgui.window.titlebar.button.down
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.titlebar.button.down.png
         }
      }
   }
}
material qgui.window.titlebar.button.over
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.titlebar.button.over.png
         }
      }
   }
}
material qgui.window.border.bottom
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.border.bottom.png
         }
      }
   }
}
material qgui.window.border.left
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.border.left.png
         }
      }
   }
}
material qgui.window.border.right
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.border.right.png
         }
      }
   }
}
material qgui.window.border.top
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.window.border.top.png
         }
      }
   }
}
material qgui.button
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.button.png
         }
      }
   }
}
material qgui.button.disabled
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.button.disabled.png
         }
      }
   }
}
material qgui.button.down
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.button.down.png
         }
      }
   }
}
material qgui.button.over
{
   technique
   {
      pass
      {
         lighting off
         ambient 1 1 1
         diffuse 1 1 1
         specular 1 1 1 30
         scene_blend alpha_blend
         texture_unit
         {
            texture qgui.button.over.png
         }
      }
   }
}

Usage

This example code shows how to set up a small GUI:

// Setup
MQuickGUI.GUIManager.Singleton._notifyWindowDimensions(800, 600); // Better update this to your current viewport's size!
MQuickGUI.GUIManager.Singleton.createMouseCursor(new Vector2(32, 32), "qgui.pointer");

// Create sheet and some widgets
MQuickGUI.Sheet sh = MQuickGUI.GUIManager.Singleton.createSheet("main sheet");
MQuickGUI.Window win = sh.createWindow("main window", new Vector4(50, 50, 400, 200), "qgui.window", MQuickGUI.QGuiMetricsMode.QGUI_GMM_PIXELS, MQuickGUI.QGuiMetricsMode.QGUI_GMM_PIXELS);
win.setText("window title");
MQuickGUI.Button bt = win.createButton("test button", new Vector4(50, 50, 100, 30), MQuickGUI.QGuiMetricsMode.QGUI_GMM_PIXELS, MQuickGUI.QGuiMetricsMode.QGUI_GMM_PIXELS, "qgui.button");
bt.setText("click me");

MQuickGUI.GUIManager.Singleton.setActiveSheet(sh);


Simple input handling with MOIS:

// Do this in OnFrameStarted():

// If mouse does not move in the whole window (cursor moves only for a few pixels), add this code berofe injectTime() method:
// mouseState.width = 800; // window Width
// mouseState.height = 600; // window Height

MQuickGUI.GUIManager.Singleton.injectTime(evt.timeSinceLastFrame);

// Do this in your mouse handling method:
MQuickGUI.GUIManager.Singleton.injectMousePosition(mouseState.X.abs, mouseState.Y.abs) // Mouse cursor movement.

MQuickGUI.GUIManager.Singleton.injectMouseButtonDown(MOIS.MouseButtonID.MB_Left); // Do this when MOIS says left mouse button is down.
MQuickGUI.GUIManager.Singleton.injectMouseButtonUp(MOIS.MouseButtonID.MB_Left); // Do this when MOIS says left mouse button is up.

// At the moment, keys have to be injected with their character into the GUI. The injectKeyCode() function isn't working.
MQuickGUI.GUIManager.Singleton.injectChar('a');


It is imperative to properly clean up the -GUI when shutting down, otherwise you will get lots of AccessViolationExceptions when disposing. The cleanup has to be done in the same thread that created the GUI.

// Clean up
MQuickGUI.GUIManager.Singleton.destroySheet(sh);

See also