Base Controls - Grisgram/gml-raptor GitHub Wiki
✔Base Controls
- Containers - Tooltips - Clickables - Checkables - ListBox - InputBox - Mouse Cursor - ControlTree
All controls share the same base set of Variable Definitions
.
As you have seen in the image of the object hierarchy in UI Subsystem, the control objects share many of their variable definitions, and each child is adding some variables to the common variables defined in the _baseControl
.
This object is the base of all controls. All the variable definitions you see here, are available in every raptor control.
text |
The most important variable. It contains the text to be displayed on the control. You see the value =text/not/set as default entered here. This shall show you, how to enter text values.You can enter any string directly like "Start Game" or "Exit Game", but if the value starts with an equals sign ( = ), it will be resolved through LG Localization. The path-string is the path in the LG file.Look at the Example Project to see how this works |
text_color text_color_mouse_over draw_color draw_color_mouse_over
|
These are the color properties for how the control will draw itself. I consider them to be self-explanatory |
text_color_anim_frames draw_color_anim_frames
|
Set this to any frame count to activate a smooth color transition/animation over a specified time, instead of simply switching between colors |
is_enabled |
A bool value which lets you disable a control, so it will not react on any event and in addition gets rendered through the GrayscaleShader, so it looks like any disabled control you know from classic desktop development |
on_enabled_changed |
A callback that gets invoked, when the enabled state of the control changes through the set_enabled function. |
font_to_use |
You can use any font and also any dynamically baked scribble font in this property. It is a "string" , not an asset or expression |
outline_color |
If you use a baked outline font from scribble , you can set the outline color of the text here |
shadow_color shadow_alpha
|
If you use a baked outline font from scribble , you can set the shadow values of the text here |
startup_width startup_height
|
If you set those to something different, than -1 , the control will be rendered with these dimensions, when created. Leave it at -1 , to make use of autosize and/or the drawn dimensions in the Room Editor
|
min_width min_height
|
Minimum render dimensions |
scribble_text_align |
What you enter here will be prefixed to the text before it gets rendered. This can reduce the amount of formatting commands in your LG files greatly and makes it easier for translators to convert to other languages |
text_xoffset text_yoffset
|
You can offset the text in addition to the nine-slicing of the underlying sprite |
text_angle |
Independent from the image_angle of the underlying sprite, you can set any angle for the text |
draw_on_gui |
This flag is very important if you use Effect Layers in your game. Eveything drawn in the draw_gui event is not affected by these layers. However, if you want your controls being affected by these effects (like pixelated text), set this to false . |
autosize |
By default, every control will resize itself based on the (formatted) text dimensions of the underlying scribble text object, except it is part of a ControlTree, then the layouting of the tree will take over to calculate correct render size |
adopt_object_properties |
This enum allows you apply properties to the scribble text object. Options available are: none - Nothing is applied (the default)alpha - The image_alpha and image_blend of the sprite will be applied to the scribble textfull - In addition to alpha and blend, scribble receives also image_xscale/yscale and the image_angle values |
/// @func get_window()
/// @desc If this control is embedded in a Window or Panel, this function returns
/// the Window/Panel instance, otherwise undefined
get_window = function() {
/// @func is_window_hidden()
/// @desc If this control is embedded in a Window or Panel, this function returns
/// the window's LAYER_OR_OBJECT_HIDDEN state.
/// If it is not part of a window or panel, false is returned.
is_window_hidden = function() {
/// @func get_window_tree()
/// @desc If this control is embedded in a Window or Panel, this function returns
/// the root tree of the control hierarchy
get_window_tree = function() {
/// @func get_parent()
/// @desc If this control is embedded in a control tree, this function returns
/// the direct parent control of this one (i.e. a Panel or something similar)
get_parent = function() {
/// @func get_parent_tree()
/// @desc If this control is embedded in a control tree, this function returns
/// the parent control tree of this one
get_parent_tree = function() {
/// @func is_topmost()
/// @desc True, if this control is the topmost (= lowest depth) at the specified position
/// NOTE: This is an override of the method in _raptorBase, which compares against _raptorBase!
/// This method here checks only controls (_baseControl) to be more specific in finding topmost
is_topmost = function(_x, _y) {
✔Base Controls
- Containers - Tooltips - Clickables - Checkables - ListBox - InputBox - Mouse Cursor - ControlTree