QuickGUI System-Explanation Document?
Hi, I was just wondering if there was (or could be? :) a document online that explains how QuickGUI's widget system works. It looks like a lot of things come from the window widget right now? Anyway, I'm not really sure -- I'm about to dive into the QuickGUI demo header file, which will hopefully make things clearer, but a paragraph of text just on how QuickGUI is built up, what inherits from what, what needs updating and what uses the existing window/preexisting Ogre variables etc, would be very useful.
One other quick question on character injection -- can QuickGUI be easily modified/left unmodified to work with unbuffered input? I'm using OIS in my game/world editor loops, but I'm checking for specific character codes each time, rather than using events, and I see that your QuickGUI demo uses buffered input, to some degree.
When I get the time I can try to make a document. For now, I can try to give information in this thread.
There is a base class, called Widget, from which all other Widgets inherit. This class performs all of the basic and popular operations all other widgets require, such as event handling, toggling visibility, moving, dragging, etc. Each Widget may or may not be able to create another Widget. The Panel Widget is able to create most widgets, except for the Sheet and Window Widget. These 2 Widgets derive from the Panel Widget, with the Sheet being able to create Window Widgets. Sheet Widgets are created from the GUIManager class. For many Widgets I have created, I derive them from the Label Widget, which contains of a background and text. For example, the Button Widget is a Label that changes its appearance depending on whether the mouse is over it, or the left mouse button is down over it. A TrackBar is a label with a Button, that slides from one end to the other.
For a diagram of inheritance, I'd have to look into the code as well.
Use of unbuffered input is possible. Input is captured through your input system, for example OIS. When you receive this input, you can decide what to do with it. (for example, inject this input into QuickGUI) When you receive unbuffered input, just inject input into the GUIManager and it will work.
Heya, that all sounds great - thanks for the quick response, and for all the information. It's especially good to hear about input.
I may be able to figure this out from the existing widgets, but in case I can't -- is there an easy way to do something like a command console? What I want is a widget in the corner of my main rendering window, with a log of executed commands. It would need to be scrollable vertically. Anyway, maybe I can attach a label to a trackbar, or somesuch.
Thanks for all your work,
Oh, and -- I notice the demo uses certain images (or I assume they are images): e.g. demo.pointmode . I'm trying to get a sense of what sorts of image QuickGUI is good with, but I couldn't find these in the QuickGUIv0.9.5v2 zip file. Are these kicking about somewhere?
Also, regarding Ogre::Vector4s:
QuickGUI::Menu *topMenu = guiSheet->createMenu(Ogre::Vector4(0,0,1,0.04));
Ogre tells me those are X, Y, Z and W co-ords: what is QuickGUI doing with those? I understand the first two values (the menu's origin is the top left corner) but how do the other two figures work? Are they relative co-ords/percentages of the screen?
You'll find all the required files in the first release, v0.9.5 download.
x,y are the position of the widget
z,w are the size of the widget
The values can be in relative, absolute, or pixel. By default, relative is used, but you can specify the others as arguments, ie QGUI_GMM_PIXEL, or QGUI_GMM_ABSOLUTE.
For creating a console widget, I plan to create one, but you can try to implement it yourself if you can't wait.
It may take some work, text widgets haven't been worked on much, aside from the textbox widget. For a scrollbar, I would probably inherit from TrackBar, and add 2 buttons, so you can change the value from the ends, like traditional scrollbars.
Thanks a lot for that information.
Sorry to post on again on this thread - and with another, different question! I set up some of your sample materials in order to handle the default materials and textures for a couple of elements (menu, menulistitem, label) in my testing GUI, but when it got to fonts it didn't work out. I have loaded font resources (4 .ttf files: the main one is called vibrocen.ttf) using the Ogre::ResourceGroupManager. However, when I use the Sheet's setDefaultFont method, and then try to run my label, Ogre tells me it can't find the font:
23:27:45: OGRE EXCEPTION(5:ItemIdentityException): Could not find font vibrocen.ttf in TextAreaOverlayElement::setFontName at ..\src\OgreTextAreaOverlayElement.cpp (line 360)
It's clearly looking for the right font. I've tried using 'Vibrocentric', 'vibrocen' and 'vibrocen.ttf' in case I wasn't naming it correctly, but none of them work. The resources should have been found -- I have loaded my textures fine using this method in other instances. In case I needed to use the font resource manager, I tried this line:
Ogre::ResourcePtr tmp = Ogre::FontManager::getSingleton().load("./data/font/vibrocen.ttf","font");
But that gave me the error:
1>..\src\WorldEditor.cpp(57) : error C2027: use of undefined type 'Ogre::FontManager'
1> e:\Game\repos\client\trunk\ogre\ogreinclude\OgrePrerequisites.h(236) : see declaration of 'Ogre::FontManager'
1>..\src\WorldEditor.cpp(57) : error C2228: left of '.load' must have class/struct/union
1> type is ''unknown-type''
Ogre.h is included in that file, however. Anyway, so, basically, I'm at a loss right now. If you have any idea what could be up, I'd appreciate your assistance (again!).
I haven't worked with fonts much, but you should be able to define it as a resource inside a *.fontdef file, like this example:
Make sure the .fontdef file is in a resource directory specified in your resources.cfg. Then just refer to the font as "BlueHighway" in your code.
Hope that helps!
i think u may need