Instructional Buttons Overview - alexguirre/RAGENativeUI GitHub Wiki
TBD
TBD
[Example]
RAGENativeUI adds support for displaying arbitrary key icons in the help text (and other scaleforms that use SET_FORMATTED_TEXT_WITH_ICONS
internally) via ~
tokens.
The InstructionalKey
enum provides values for all keys, mouse buttons, mouse wheel, mouse axis, controller buttons, controller axis and other icons that can be displayed.
With the InstructionalKey
extension method GetId()
, you can obtain the token required to display the specified icon. For example, for a busy spinner:
Game.DisplayHelp($"~{InstructionalKey.SymbolBusySpinner.GetId()}~ Loading...");
For the System.Windows.Forms.Keys
and Rage.ControllerButtons
enums there exist the extension methods GetInstructionalKey()
, which returns the equivalent InstructionalKey
, and GetInstructionalId()
, which is the same as GetInstructionalKey().GetId()
. For example, displaying LCtrl + E:
Game.DisplayHelp($"Press ~{Keys.LControlKey.GetInstructionalId()}~ ~+~ ~{Keys.E.GetInstructionalId()}~");
// The token `~+~` is an alias for the icon `InstructionalKey.SymbolPlus`
Or displaying the D-pad right icon:
Game.DisplayHelp($"Press ~{ControllerButtons.DPadRight.GetInstructionalId()}~");
Note that key icons are localized when using the InstructionalKey
enum, and therefore when using any of these extension methods. For example, with US keyboard layout, Keys.LControlKey
will be displayed as L Ctrl, but with spanish layout, as Ctrl I.
The underlying format used is similar to the one used by the instructional_buttons
scaleform and the native functions GET_CONTROL_INSTRUCTIONAL_BUTTON
and GET_CONTROL_GROUP_INSTRUCTIONAL_BUTTON
. Supported tokens:
-
t_[char]
/T_[char]
: char must match one of the keysText
in the current keyboard layout (see layout files in\update\update.rpf\x64\data\control\keyboard layout\
) (example:t_A
) -
b_[id]
: special keys/icons (example:b_20
) - Groups of
t_
/T_
/b_
tokens separated by%
(example:t_A%b_20
) -
+
: alias forb_998
(plus symbol)
For example, displaying LCtrl + E:
Game.DisplayHelp("Press ~b_1013~ ~+~ ~t_E~");