Class Menus
A set of static methods to deal with MLEM.Ui and in-game menus
public static class Menus
- Inheritance
-
Menus
- Inherited Members
Methods
GamepadHint(Anchor, Func<Options, Buttons>, Vector2, Vector2?, Func<bool>)
Returns a new image that displays information about what gamepad Microsoft.Xna.Framework.Input.Buttons can be pressed to invoke an action.
This image is automatically hidden if gamepad controls are not currently being used, or if shouldHide
returns true.
public static Image GamepadHint(Anchor anchor, Func<Options, Buttons> button, Vector2 positionOffset = default, Vector2? size = null, Func<bool> shouldHide = null)
Parameters
anchor
AnchorThe anchor for the image.
button
Func<Options, Buttons>A function that returns the button that should be displayed.
positionOffset
Vector2The position offset for the image.
size
Vector2?The size of the image, or null for the image to be 12 pixels big.
shouldHide
Func<bool>A function that determines whether the hint should currently be hidden, or null to only hide it when gamepad controls are not currently being used.
Returns
- Image
The created gamepad hint image.
MenuBackground(int, int, int, int)
Returns a MLEM.Textures.NinePatch that contains a menu background texture region, based on the given data.
public static NinePatch MenuBackground(int x, int y, int width = 1, int height = 1)
Parameters
x
intThe x coordinate of the menu background section to return, which is expected to be between 0 and 1.
y
intThe y coordinate of the menu background section to return, which is expected to be between 0 and 1.
width
intThe width of the menu background section to return, which is expected to be between 1 and 2.
height
intThe height of the menu background section to return, which is expected to be between 1 and 2.
Returns
- NinePatch
A MLEM.Textures.NinePatch that contains a menu background texture region.
Transition(Action, Action, TransitionType, TransitionType, float, float, float, Color?)
Displays a screen transition that includes a fade out, an inbetween
action, followed by a fade back in and an after
action.
public static void Transition(Action inbetween = null, Action after = null, Menus.TransitionType outType = TransitionType.Swipe, Menus.TransitionType inType = TransitionType.Swipe, float outSpeed = 0.05, float inSpeed = 0.05, float waitInbetween = 0.15, Color? color = null)
Parameters
inbetween
ActionThe action that is invoked while the screen is faded out, or null to invoke no action.
after
ActionThe action that is invoked after the full fade routine completes, or null to invoke no action.
outType
Menus.TransitionTypeThe Menus.TransitionType used for fading out.
inType
Menus.TransitionTypeThe Menus.TransitionType used for fading in.
outSpeed
floatThe speed with which
outType
is displayed per frame.inSpeed
floatThe speed with which
inType
is displayed per frame.waitInbetween
floatThe amount of time to wait while the screen is faded out.
color
Color?The color that the fade should have, or null to use black.
Exceptions
- InvalidOperationException
Thrown when a fade is already happening when this method is called.