S&box Wiki

Input Glyphs

Input glyphs are an easy way to show users which buttons to press for actions, they automatically adjust for whatever device you're using and return appropriate textures.

image.png
Texture JumpButton = Input.GetGlyph( "jump" );
You should set your UI image every tick with Input.GetGlyph, this is because the user can rebind keys or the input device can change part way through a game.

Styles

There's some different styles and style modifiers you can chain to get the right look for your UI.

  • Knockout: the ABXY face buttons will have colored labels/outlines on a knocked out background.
  • Light: black detail/borders on a white background .
  • Dark: white detail/borders on a black background

Modifiers

Modifiers ( Default ABXY/PS equivalent glyphs have a solid fill w/ color matching the physical buttons on the device )

  • WithSolidABXY: ABXY Buttons will have a solid fill.
  • WithNeutralColorABXY: ABXY Buttons will match the base style color instead of their normal associated color.
ImageGlyph.Texture = Input.GetGlyph( InputAction, InputGlyphSize.Small, GlyphStyle.Knockout.WithSolidABXY().WithNeutralColorABXY() );
With neutral colored glyphs you can always use SCSS to tint the glyph colors to better suit your game's UI - see background-image-tint for more info.