Class ImageCode
- 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 ImageCode : Code, IGenericDataHolder
- Inheritance
-
ImageCode
- Implements
- Inherited Members
Constructors
ImageCode(Match, Regex, SpriteAnimation, bool)
public ImageCode(Match match, Regex regex, SpriteAnimation image, bool copyTextColor)
Parameters
match
Matchregex
Regeximage
SpriteAnimationcopyTextColor
bool
Methods
DrawSelf(GameTime, SpriteBatch, Token, Vector2, Vector2, GenericFont, Color, Vector2, float, Vector2, float, SpriteEffects, Vector2)
Draws the token itself, including all of the Code instances that this token contains. Note that, to draw the token's actual string, DrawCharacter(GameTime, SpriteBatch, int, string, int, Vector2, Vector2, GenericFont, Color, Vector2, float, Vector2, float, SpriteEffects, Vector2, Vector2) is used.
public override void DrawSelf(GameTime time, SpriteBatch batch, Token token, Vector2 stringPos, Vector2 charPosOffset, GenericFont font, Color color, Vector2 scale, float rotation, Vector2 origin, float depth, SpriteEffects effects, Vector2 stringSize)
Parameters
time
GameTimeThe time
batch
SpriteBatchThe sprite batch to use
token
TokenstringPos
Vector2The position the string is drawn at.
charPosOffset
Vector2The offset from the
stringPos
that the current character is drawn at.font
GenericFontThe font to use to draw
color
ColorThe color to draw with
scale
Vector2The scale to draw with.
rotation
floatThe rotation to draw with.
origin
Vector2The origin to subtract from the position.
depth
floatThe depth to draw at
effects
SpriteEffectsThe flipping to draw with.
stringSize
Vector2The size of the string.
EndsHere(Code)
Returns whether this formatting code should end when the passed formatting code starts. If this method returns true, a new Token is started at its position. This is the opposite version of EndsOther(Code).
public override bool EndsHere(Code other)
Parameters
other
CodeThe code that is started here.
Returns
- bool
If this code should end here.
GetSelfWidth(GenericFont)
Returns the width of the token itself, including all of the Code instances that this token contains. Note that this method does not return the width of this token's DisplayString, but only the width that the codes themselves take up.
public override float GetSelfWidth(GenericFont font)
Parameters
font
GenericFontThe font to use for calculating the width.
Returns
- float
The width of this token itself.
Update(GameTime)
Update this formatting code's animations etc.
public override void Update(GameTime time)
Parameters
time
GameTimeThe game's time