Class LinkCode
- Namespace
- MLEM.Formatting.Codes
- Assembly
- MLEM.dll
An instance of a formatting code that can be used for a TextFormatter. To add a new formatting code, see Codes
public class LinkCode : UnderlineCode, IGenericDataHolder
- Inheritance
-
LinkCode
- Implements
- Inherited Members
Constructors
LinkCode(Match, Regex, float, float, Func<Token, bool>, Func<Color, Color?>)
public LinkCode(Match match, Regex regex, float thickness, float yOffset, Func<Token, bool> isSelected, Func<Color, Color?> color)
Parameters
matchMatchregexRegexthicknessfloatyOffsetfloatisSelectedFunc<Token, bool>colorFunc<Color, Color?>
LinkCode(Match, Regex, float, float, Func<Token, bool>, Color?)
public LinkCode(Match match, Regex regex, float thickness, float yOffset, Func<Token, bool> isSelected, Color? color = null)
Parameters
Fields
Color
A function that returns the color to use when rendering this link code. The passed Color parameter is the color that the text currently has.
public Func<Color, Color?> Color
Field Value
- Func<Color, Color?>
IsSelectedFunc
A function that returns whether the link is currently considered selected, in which case it will draw with an underscore by default. This function is queried in IsSelected().
public Func<Token, bool> IsSelectedFunc
Field Value
Methods
DrawCharacter(GameTime, SpriteBatch, int, string, Token, int, Vector2, ref Vector2, GenericFont, ref Color, ref Vector2, ref float, ref Vector2, float, SpriteEffects, Vector2, Vector2)
Draws a given code point using this token's formatting options.
public override bool DrawCharacter(GameTime time, SpriteBatch batch, int codePoint, string character, Token token, int indexInToken, Vector2 stringPos, ref Vector2 charPosOffset, GenericFont font, ref Color color, ref Vector2 scale, ref float rotation, ref Vector2 origin, float depth, SpriteEffects effects, Vector2 stringSize, Vector2 charSize)
Parameters
timeGameTimeThe time
batchSpriteBatchThe sprite batch to use
codePointintThe code point of the character to draw
characterstringThe string representation of the character to draw
tokenTokenindexInTokenintThe index within this token that the character is at
stringPosVector2The position the string is drawn at.
charPosOffsetVector2The offset from the
stringPosthat the current character is drawn at.fontGenericFontThe font to use to draw
colorColorThe color to draw with
scaleVector2The scale to draw with.
rotationfloatThe rotation to draw with.
originVector2The origin to subtract from the position.
depthfloatThe depth to draw at
effectsSpriteEffectsThe flipping to draw with.
stringSizeVector2The size of the string.
charSizeVector2The size of the current character.
Returns
GetColor(Color)
Get the color that this token will be rendered with
public override Color? GetColor(Color defaultPick)
Parameters
defaultPickColorThe default color, if none is specified
Returns
- Color?
The color to render with
IsSelected()
Returns true if this link formatting code is currently selected or hovered over, based on the selection function.
public virtual bool IsSelected()
Returns
- bool
True if this code is currently selected