Class XeluButtonSpriteMap
Definition
Namespace: StardewUI.Graphics
Assembly: StardewUI.dll
Controller/keyboard sprite map based on Xelu's CC0 pack.
Inheritance
Object ⇦ ButtonSpriteMap ⇦ XeluButtonSpriteMap
Remarks
Uses specific sprites (Xbox-based) per gamepad button, with a fallback for unknown buttons. All keyboard keys use the same placeholder border/background sprite with the expectation of having the key name drawn inside, in order to at least be consistent with Stardew's fonts.
Members
Constructors
Name | Description |
---|---|
XeluButtonSpriteMap(Texture2D, Texture2D, Texture2D) | Controller/keyboard sprite map based on Xelu's CC0 pack. |
Properties
Name | Description |
---|---|
ControllerBlank | A blank controller button upon which the specific button label can be drawn. (Overrides ButtonSpriteMap. get_ControllerBlank() ) |
KeyboardBlank | A blank keyboard key upon which the specific key name can be drawn. (Overrides ButtonSpriteMap. get_KeyboardBlank() ) |
KeyboardTheme | The active theme for keyboard sprites. |
MouseLeft | The mouse with left button pressed. (Overrides ButtonSpriteMap. get_MouseLeft() ) |
MouseMiddle | The mouse with middle button pressed. (Overrides ButtonSpriteMap. get_MouseMiddle() ) |
MouseRight | The mouse with right button pressed. (Overrides ButtonSpriteMap. get_MouseRight() ) |
MouseTheme | The active theme for mouse sprites. |
SliceScale | Scale to apply to nine-slice sprites, specifically keyboard blanks. |
Methods
Name | Description |
---|---|
Get(SButton) | Gets the specific sprite for a particular button. (Overrides ButtonSpriteMap.Get(SButton)) |
Get(SButton, Boolean) | Gets the sprite corresponding to a particular key. (Inherited from ButtonSpriteMap) |
Details
Constructors
XeluButtonSpriteMap(Texture2D, Texture2D, Texture2D)
Controller/keyboard sprite map based on Xelu's CC0 pack.
public XeluButtonSpriteMap(Microsoft.Xna.Framework.Graphics.Texture2D gamepad, Microsoft.Xna.Framework.Graphics.Texture2D keyboard, Microsoft.Xna.Framework.Graphics.Texture2D mouse);
Parameters
gamepad
Texture2D
Gamepad texture atlas, loaded from the mod's copy of GamepadButtons.png
.
keyboard
Texture2D
Keyboard texture atlas, loaded from the mod's copy of KeyboardKeys.png
.
mouse
Texture2D
Mouse texture atlas, loaded from the mod's copy of MouseButtons.png
.
Remarks
Uses specific sprites (Xbox-based) per gamepad button, with a fallback for unknown buttons. All keyboard keys use the same placeholder border/background sprite with the expectation of having the key name drawn inside, in order to at least be consistent with Stardew's fonts.
Properties
ControllerBlank
A blank controller button upon which the specific button label can be drawn.
Property Value
Remarks
If the sprite specifies non-zero FixedEdges then they will be added to the label's margin.
KeyboardBlank
A blank keyboard key upon which the specific key name can be drawn.
Property Value
Remarks
If the sprite specifies non-zero FixedEdges then they will be added to the label's margin.
KeyboardTheme
The active theme for keyboard sprites.
Property Value
MouseLeft
The mouse with left button pressed.
Property Value
MouseMiddle
The mouse with middle button pressed.
Property Value
MouseRight
The mouse with right button pressed.
Property Value
MouseTheme
The active theme for mouse sprites.
Property Value
SliceScale
Scale to apply to nine-slice sprites, specifically keyboard blanks.
Property Value
Remarks
This setting exists because the sprite assets are much larger than the space available for a typical keybind image in a menu, which - very unusually for Stardew - means they need to be scaled down, not up. However, some UIs (e.g. some overlays) may want to display these sprites at their normal size or larger, and in these cases, should not scale the slices because the borders would look strange or hard to see.
In general, considering the base dimensions of 100x100, a comfortable size for menus targeting roughly 48px button height should use roughly 1/3 scale (0.3). Overlays and other UIs intending to render the sprite at full size (or larger) can leave the default of 1.
Methods
Get(SButton)
Gets the specific sprite for a particular button.
Parameters
button
SButton
The button for which to retrieve a sprite.
Returns
The precise Sprite representing the given button
, or null
if the button does not have a special sprite and could/should use a generic background + text.