But main aim of releasing it is to let community develop many new cool controls
GUI has no name, it is just pack of overlay based controls. Main features now are:
- No additional libraries needed
- Very simple to use!
- Very easy to create new control type
- Perfect for map editors, character editors etc.
- Controls: Form, Label, Edit, Button, Scrollbar, Number (like the Blender3D number fields with mouse "scrolling")
Some rules:
- All controls must be children of Form
- Control shoud have unique name
And instruction:
1. Creating the system
Code: Select all
Interface::ControlMgr myControlMgr;
myControlMgr.Initialise("BlueHighway", 16);
myControlMgr.CreateMouse(mMouse, "bgui.pointer", 32, 32);
myControlMgr.CreateKeyboard(mKeyboard);
myControlMgr.MaterialButton= "bgui.button";
myControlMgr.MaterialButtonPressed="bgui.button.active";
myControlMgr.MaterialForm= "bgui.window";
myControlMgr.MaterialHeader= "bgui.window.titlebar";
myControlMgr.MaterialEdit = "bgui.textinput";
myControlMgr.MaterialEditFocused = "bgui.textinput.active";
mMouse and mKeyboard are just OIS::... pointers.
2. Updating GUI
Code: Select all
myControlMgr.Update(TimeDelta);
3. Creating controls
3.1 Setting up Form
Code: Select all
Interface::ControlForm *myForm=new Interface::ControlForm("my cool form name", myControlMgr.Root);
myForm->Caption="My Window!";
myForm->X=200;
myForm->Y=200;
myForm->Width=400;
myForm->Height=200;
3.2 Let's create button!
Code: Select all
Interface::ControlButton *myButton=new Interface::ControlButton("button name", myForm);
myButton->Caption="Press Me!";
myButton->X=30;
myButton->Y=30;
myButton->Width=100;
myButton->Height=30;
Buttons usually do something when pressed. It is done by setting event function:
Code: Select all
myButton->OnPressed=myOnPressedFunction;
To see more variables of controls, just see headers.
4. Creating new control type
4.1 Main rule is that all controls must inherits from Control type. Simples one:
Code: Select all
#include "Control.h"
namespace Interface {
class ControlMyType:public Control {
public:
ControlMyType(Ogre::String name, Control *parent);
bool Update();
bool Remove();
};
};
4.4 ctor
Basic contructor must set type name to itself, and define parent and manager like this:
Code: Select all
ControlLabel::ControlLabel(Ogre::String name, Control *parent)
{
Type="Label";
Name=name;
Parent=parent;
Manager=parent->Manager;
...
...
...
Parent->AddChildren(this);
};
Thats all. I think it is very simple code to modify.
I'll create new controls sometime (but only ones which I need to my work)
If you create some new controls, you can post but it would be nice if you'll keep the existing notation:
- ControlTypeName.cpp and ControlTypeName.h
- Names of variables and methods started with capital.
- class named Control{Type name}
- no additional libraries, to keep simplicity
Links:
Source: http://www.sendspace.com/file/wingk6
Video (utube): http://www.youtube.com/watch?v=TqHwbeH7XsU
Video (file): http://www.sendspace.com/file/y56fc5
Screen: