![]() |
S2ENGINE HD
1.4.6
Official manual about S2Engine HD editor and programming
|
Starting from S2Engine HD 1.4.6 there is a new tool for editing GUI, now in BETA version.
To open GUI editor click on Tools->GUIEditor on the main menu as showed into the following image:
GUI is created by a special type of object called GUI, also GUIObject.
GUIObject is an object containing a MainFrame (also known as HUD) widget.
It has the following parameters:
name Name of the objectguiScript Filename of the script resource the GUI usesshowCursor True if GUI must show the mouse cursorfsm The Game Machine resource applied to the GUI objectcursorTexture Filename of the texture resource to apply to GUI cursorcursorWidth Width of GUI cursorcursorHeight Height of GUI cursortexname Filename of the GUI background texture resourceTo Create a GUIObject:
Once you have created the GuiObject you can edit your GUI. Open the GUI Viewport (see viewports). In the Widgets panel click on Add Widget button to add a new widget:
The widget will be void but selected. Selected widgets have an orange border that point out them.
You can set widgets parameters in the Params Class box as showed in the up image.
Widget parameters you can set in the class params box are following:
name Name of the widgetwidgetScript Script for widget logicwidgetClass Class widget must belong to (default is button)text text of the widget. For example label textX X coordinate of the widget in screen spaceY Y coordinate of the widget in screen spacewidth width of the widgetheight height of the widgetfont Font resource filename this widget must usetexname Filename of Texture resource used for widget backgroundlitTexname Filename of Texture resource used when mouse overgrayedTexname Filename of Texture resource used when widget is grayedtextAlign Text align: -1 left, 0 - center, 1 - rightverticalAlign Vertical alignment of the widget respect to the parent widget. -1 top, 0 - center, 1 - bottom, 2 - nonehorizontalAlign Horizontal alignment of the widget respect to the parent widget. -1 left, 0 - center, 1 - right, 2 - nonetextColor Color of the widget textlitTextColor Color of the widget text when mouse overgrayedTextColor Color of the widget text when grayedparent Parent widget reference. If none the parent is assumed to be the main GUI widget.TextSizeX Horizontal size of widget text charactersTextSizeY Vertical size of widget text charactersTextSpace Space, in pixels, between characters of widget textborderColor Color of widget border if existsborder True if widget has border, false otherwisetextureColor Color to be multiplied by the widget background textureOpacity Opacity of the widgetfadeSpeed Speed widget must fade in when createdclickTexname Filename of the texture resource widget shows when clicked (works if widget is button like)clickTextColor Color to be multiplied by the texture widget shows when clicked (works if widget is button like)startHided True if widget must start hidedbutton slider frame inputbox combobox label checkbutton colorbox image listbox groupbox tabbox rangeinputbox
Widget objects can also be scripted, you can assign them a script in the widgetScript parameter.
You can create a widget using the GUI Editor and then link to it a script that creates other child widgets.
To know how to script a widget you can see Widgets.