All objects descend from ui_defaults. An advantage of that is you can set the defaults for your project like uiTextColor, uiFont, uiBackColor by changing it within the create method of the ui_defaults object. That way you won’t need to set it on all instances on each room, it is like a default color theme for the current project. Of course, all the defaults can be overwritten at the individual level within the room editor.
We’ll discuss the base ui_defaults properties: Some are self explanatory; Using the sample project you can see/testsome of the changes:
uiTextValue=””; This will set the TextValue of the control, like the text that appears on the button or label.
uiBackColor= c_white; The background color of the control.
uiDrawBackColor = true; If you want to make the control transparent (disable the uiBackColor) from drawing.
uiTextColor= c_black; The color of the text that is drawn on the control
uiDrawOutline = false; fill button when drawing. Will draw an outline around a button, without flood-filling the background color;
uiBorderColor=c_white; If widget has a border, like a listbox.
uiBorderBackColor=c_gray; If widget has a border, like a listbox.
uiFont = font_ui; This is the font used by the widget.
uiEnabled = true/false; This will display the widget at 50% alpha, and will not allow any GUI interaction by the user. No events will be fired when disabled;
uiVisible= true/false; This will hide/show widget.
uiSetWidth= 1000; This will set the widgets width in pixels, don’t have to worry about image_xscale. Normally you don’t need to set this because its set by the room designer. But if you are creating the controls in code this will simplify it.
uiSetHeight= 1000; This will set the widgets height in pixels, don’t have to worry about image_yscale. Normally you don’t need to set this because its set by the room designer. But if you are creating the controls in code this will simplify it.
uiGUIWidth=room_width; usually not changed, but will allow you to set your GUI Width for centering and such, it defaults to room_width.
uiGUIHeight=room_height; usually not changed, but will allow you to set your GUI Height for centering and such, it defaults to room_height.
uiCurWidth=sprite_width; will return the current width of the object in pixels
uiCurHeight=sprite_height; will return the current height of the object in pixels
uiClickSound=snd_yourSoundindex; will play this sound when pressed //see widget sounds section for more info
uiRadiusX=15; when drawing widget, default is rounded corners, this is the X radius of corner. If you want square looking widget, then set this to 0.
uiRadiusY=15; when drawing widget, default is rounded corners, this is the Y radius of corner. If you want square looking widget, then set this to 0.
uiCanHover=false; if you want to disable any hovering over the current widget
uiAngle=0; Angle of widget (for labels and such), uses the same angle format as Studio
uiClickOnChar=chr(1); for widgets, will emulate ‘press’ of widget when the key is pressed. example chr(53) is “5”
uiViewFixed=false; for widgets, default will draw at position (x,y). When this is set to true it will draw (x,y) relative to the current view.
isHovering=false; for widgets, read-only to determine if user is currently hovering over the widget. (uiCanHover must be set to true prior).
uiDestroy=25; for widgets, this will automatically destroy the widget in x steps. This is useful for popup labels and quick-draw widgets.
Setting Theme /Defaults
In v1.4+ all widgets will call scr_gui_setdefaults script as the last item in its create method. This allows you to setup global defaults for all widgets like the default font, colors and animation types. Of course you can override them individually afterwards but this can save you from always setting the defaults inside the room editor. There are no arguments sent to the scr_gui_setdefaults script.