Any control can have its own background instead of its theme style: the UI editor inspector's Background section. Buttons, toggles and check boxes also have a States section: a picture or a colour for each state. Everything is an ordinary Variable Definition override on the instance, so GameMaker opens and builds the room as it is.
- Theme: the theme's style for the control (a box: nothing; boxes are invisible by default). None: nothing behind it.
- Colour: a flat box: the fill and how see-through it is, a border (width and colour, drawn inside the edge), corners (radius) and an optional drop shadow (how far down and how soft). Values
bg_colour,border_width,border_colour,radius,shadow_colour(clear: no shadow),shadow_offset,shadow_size. - Picture: a sprite (
bg_sprite), nine-sliced by the borders set in the sprite editor, by margins set here (slice_margins:16,16,8or16,8,16,8) or not at all (bg_slice); Fill stretches the middle and edges, tiles them at the sprite's size or keeps the aspect of the whole picture (bg_fill); Tint multiplies it by a colour and opacity (bg_tint). - Padding: the space between the edge and the text (
bg_padding, like the margins; empty: the theme's). Boxes and scroll containers keep their own padding value for their children. - States (buttons, toggles, check boxes): Hover (the pointer over it), Pressed (just pressed, or held down on it), Disabled, Focus (arrows, d-pad) and, for toggles and check boxes, On. Each can be a picture (
hover_sprite…) or a colour (hover_colour…; with a colour, the border, corners and shadow are the background's). A state left empty uses normal (the background), then the theme; a check box's empty On shows the theme's checked box. Pressed text moves the text down so many pixels while pressed (press_offset). - Preview: the States section's Preview menu shows the selected control in that state on the canvas, as the game will draw it. It is not written to the room.
- Colours are GameMaker's
$AABBGGRR, alpha first. In code, change any of these values on the instance and the control draws it from the next frame. - The kit's version 1.2 adds these values. A project on 1.1 is brought up to date by the first background or state you set (in the same undo step); rooms made before keep working unchanged.
Related topics
Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.