ControlsList
A controls screen with no hand-placed buttons: while the game runs it makes a row for each input action, its name and a Rebind button showing its keys (“Drop Tool” and “Esc / Right Click”), that the player clicks and then presses a new key for. The rows follow the device being played with and the player’s rebinding, and are made again when the actions change. Put it on an entity with a Layout (in an options Panel), which lines the rows up and scrolls them; add a Reset Controls button beside it to put everything back.
Its children that hold a Rebind button are its rows: it takes them away and makes them again when what it lists changes, and leaves its other children (a heading) alone. Each plain row is an entity named after its action with a Text for the name and a Button for each of Slots; a Template gives rows of your own. The Scene view shows sample rows where they’ll go.
Requires: Layout (it lines up the rows)
Works with: Panel (an options screen it’s on)
Draws itself (its entity draws at Order 100 unless it has a Sprite, whose order counts).
In a network game, each machine keeps its own entity with this on it: it isn’t sent.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
actions: text = null. The actions to list, in this order, separated by commas, e.g. “Jump, Dash, Pause”; * stands for any letters and ? for one, so “Pan*” lists Pan Up, Pan Down, Pan Left and Pan Right. Empty lists those Show picks. (Names input actions: their names, separated by commas.) (Field: a name.)show: one of All, GameOnly = “All”. While Actions is empty: every action, or only the game’s own (not Griff’s built-in ones). (Field: one of its values.)hide: text = null. Actions to leave out, separated by commas, with * and ? as in Actions, e.g. “Debug*, Pause” for the debug keys and the pause key. (Names input actions: their names, separated by commas.) (Field: a name.)labels: text = null. The names to show for actions, “Action = Name” separated by commas, e.g. “DropTool = Put Down, PanUp = Look Up”. Any other action shows its own name in words: “DropTool” as “Drop Tool”. (Plain text: the words players read for each action.) (Field: text.)slots: a whole number = 1. How many Rebind buttons a row has. 1 shows every key of the action on the device in use (“Esc / Right Click”) on one button, which replaces the first; 2 or more give a button for each binding in turn (a primary and a secondary key), each replacing its own (see Button.BindingSlot). (Field: a number.)
template: text = null. An entity to copy for each row instead of the plain ones, by name, e.g. “Controls Row”: a disabled one in the scene styled as you like. In each copy, “{name}” in a Text becomes the action’s name and “{action}” its keys (“{action:all}”, “{action:1}” and so on, as in any Text), and a Rebind button with no Input Action rebinds the row’s action. (Names an entity.) (Field: an entity’s name.)font: text = null. A font for the plain rows’ words, as a Text’s Text.Font. Empty uses the built-in font. (Names a font.) (Field: a name.)textSize: a number = 0.45. How tall the plain rows’ words are, in world units. (Field: a number.)color: a color, “#RRGGBB” or “#RRGGBBAA” = “#E6E8ECFF”. The color of the plain rows’ words. (Field: a color.)buttonColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#3A3F4BFF”. The color of the plain rows’ Rebind buttons. (Field: a color.)rowHeight: a number = 0.8. How tall each plain row is, in world units; it’s as wide as the Layout has room for. (Field: a number.)buttonWidth: a number = 2.6. How wide each plain row’s Rebind buttons are, in world units. (Field: a number.)
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
listed: lines of text: an array of strings, or one string with line breaks. The actions it lists now, in order. Kept up to date by the game.
Scripts use it as ControlsList: its methods, events and values that aren’t saved with the scene.