Otter  0.9.88
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Text Class Reference

Graphic used to display simple text. Much faster than RichText, but more limited options. More...

Inherits Otter.Graphic.

Public Member Functions

 Text (string str, string font="", int size=16)
 Create a new Text object. More...
 
 Text (string str, Stream font, int size=16)
 Create a new Text object. More...
 
 Text (string str, Font font, int size=16)
 Create a new Text object. More...
 
 Text (string str, int size=16)
 Create a new Text object. More...
 
 Text (int size=16)
 Create a new Text object. More...
 
void CenterTextOrigin ()
 Center the Text's origin. This factors in the Text's local bounds. More...
 
void CenterTextOriginX ()
 Center the Text's X origin. This factors in the Text's left bounds. More...
 
void CenterTextOriginY ()
 Center the Text's Y origin. This factors in the Text's top bounds. More...
 
override void Render (float x=0, float y=0)
 Draw the Text. More...
 
- Public Member Functions inherited from Otter.Graphic
Transformation AddTransform (Transformation transform)
 
Transformation AddTransform (Vector2 translation, Vector2 scale, Vector2 origin, float rotation)
 
Transformation AddTransform ()
 
Transformation RemoveTransformation (Transformation transform)
 
Transformation PopTransformation ()
 
virtual void ClearShader ()
 Removes the shader from the graphic. More...
 
void SetPosition (float x, float y)
 Set the position of the Graphic. More...
 
void SetPosition (Graphic g, float offsetX=0, float offsetY=0)
 Set the position of the Graphic. More...
 
void SetPosition (Vector2 xy)
 Set the position of the Graphic. More...
 
void SetOrigin (float x, float y)
 Set the origin of the Graphic. More...
 
void SetOrigin (Vector2 xy)
 Set the origin of the Graphic. More...
 
void SetTexture (string path)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
void SetTexture (Texture texture)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
void SetTexture (AtlasTexture atlasTexture)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
virtual void Update ()
 Update the graphic. More...
 
virtual void CenterOrigin ()
 Centers the graphic origin. More...
 
virtual void CenterOriginZero ()
 Centers the graphic origin while retaining its relative position. More...
 

Public Attributes

Color ShadowColor = Color.Black
 The color of the text shadow. More...
 
int ShadowX
 The X position of the shadow. More...
 
int ShadowY
 The Y position of the shadow. More...
 
Color OutlineColor = Color.Black
 The Color of the outline. More...
 
int OutlineThickness
 The thickness of the outline. More...
 
TextOutlineQuality OutlineQuality = TextOutlineQuality.Good
 The quality of the outline. Higher quality is more rendering passes! More...
 
- Public Attributes inherited from Otter.Graphic
List< TransformationTransforms = new List<Transformation>() { new Transformation() }
 
bool Relative = true
 Determines if the Graphic is rendered relative to its Entity. More...
 
bool Visible = true
 Determines if the Graphic will render. More...
 
float ScrollX = 1
 The scroll factor for the x position. Used for parallax like effects. Values lower than 1 will scroll slower than the camera (appear to be further away) and values higher than 1 will scroll faster than the camera (appear to be closer.) More...
 
float ScrollY = 1
 The scroll factor for the y position. Used for parallax like effects. Values lower than 1 will scroll slower than the camera (appear to be further away) and values higher than 1 will scroll faster than the camera (appear to be closer.) More...
 
float ShakeX
 The horizontal amount to randomly offset the graphic by each frame. More...
 
float ShakeY
 The vertial amount to randomly offset the graphic by each frame. More...
 
Rectangle TextureRegion
 The region to render the Texture with. More...
 
Rectangle AtlasRegion
 The Rectangle to render an AtlasTexture with. More...
 
Shader Shader
 The shader to be applied to this graphic. More...
 
string Name = "Graphic"
 The name of the graphic. More...
 
BlendMode Blend = BlendMode.Alpha
 The blend mode to be applied to this graphic. More...
 
bool RepeatX
 Determines if the image should be rendered multiple times horizontally. More...
 
bool RepeatY
 Determines if the image should be rendered multiple times vertically. More...
 

Protected Member Functions

override void UpdateDrawable ()
 Updates the internal SFML data for rendering. More...
 
- Protected Member Functions inherited from Otter.Graphic
void Append (float x, float y, Color color, float u, float v)
 
void Append (float x, float y, Color color=null)
 
virtual void SFMLRender (Drawable drawable, float x=0, float y=0)
 

Properties

string String [get, set]
 The displayed string. More...
 
int Lines [get, set]
 The number of lines in the text. More...
 
float LineSpacing [get]
 The amount of space between each line of text. More...
 
int FontSize [get, set]
 The font size. More...
 
TextStyle TextStyle [get, set]
 Set the TextStyle (bold, italic, underline.) More...
 
int Shadow [set]
 Set both ShadowX and ShadowY. More...
 
float CenterY [get]
 Get the actual center Y of the Text. More...
 
float BoundsTop [get]
 The top bounds of the Text. More...
 
float BoundsLeft [get]
 The left bounds of the Text. More...
 
- Properties inherited from Otter.Graphic
Transformation Transform [get]
 
float X [get, set]
 The X position of the Graphic. More...
 
float Y [get, set]
 The Y position of the Graphic. More...
 
float ScaleX [get, set]
 The horizontal scale of the graphic. Used in the final transformation. More...
 
float ScaleY [get, set]
 The vertical scale of the graphic. Used in the final transformation. More...
 
float Angle [get, set]
 The angle of rotation of the graphic. Used in the final transformation. More...
 
float OriginX [get, set]
 The X origin point to scale and rotate the graphic with. Used in the final transformation. More...
 
float OriginY [get, set]
 The Y origin point to scale and rotate the graphic with. Used in the final transformation. More...
 
Color Color [get, set]
 The base color of the Graphic. Multiplies the vertices of the graphic by this color. More...
 
virtual Texture Texture [get, set]
 The texture that the graphic is using. More...
 
float Alpha [get, set]
 The base transparency of the graphic. A shortcut to access the base color's Alpha. More...
 
int Width [get, set]
 The width of the Graphic. More...
 
int Height [get, set]
 The height of the Graphic. More...
 
float ScaledWidth [get, set]
 The width in pixels of the image after applying the X scale. More...
 
float ScaledHeight [get, set]
 The height in pixels of the image after applying the Y scale. More...
 
virtual bool Smooth [get, set]
 Smooth the texture of a sprite image while scaling it. More...
 
float Scroll [get, set]
 Set both ScrollX and ScrollY. More...
 
float HalfWidth [get]
 Half of the width. More...
 
float HalfHeight [get]
 Half of the height. More...
 
float Scale [set]
 Sets both the ScaleX and ScaleY at the same time. More...
 
bool Repeat [set]
 Sets both RepeatX and RepeatY at the same time. More...
 
float Shake [set]
 A shortcut to set both ShakeX and ShakeY. More...
 
float Left [get]
 The X position of the left side of the Graphic. More...
 
float Top [get]
 The Y position of the top of the Graphic. More...
 
float Right [get]
 The X position of the right side of the Graphic. More...
 
float Bottom [get]
 The Y position of the bottom of the Graphic. More...
 
int TextureLeft [get]
 The X position of the left of the Texture. More...
 
int TextureRight [get]
 The X position of the right of the Texture. More...
 
int TextureTop [get]
 The Y position of the top of the Texture. More...
 
int TextureBottom [get]
 The Y position of the bottom of the Texture. More...
 

Additional Inherited Members

- Protected Attributes inherited from Otter.Graphic
VertexArray SFMLVertices = new VertexArray(PrimitiveType.Quads)
 
Drawable SFMLDrawable
 
float RepeatSizeX
 
bool roundRendering = true
 
bool Dynamic
 If true the graphic will always update its drawable. More...
 

Detailed Description

Graphic used to display simple text. Much faster than RichText, but more limited options.

Constructor & Destructor Documentation

Otter.Text.Text ( string  str,
string  font = "",
int  size = 16 
)

Create a new Text object.

Parameters
strThe string to display.
fontThe file path to the font to use.
sizeThe size of the font.
Otter.Text.Text ( string  str,
Stream  font,
int  size = 16 
)

Create a new Text object.

Parameters
strThe string to display.
fontThe stream to load the font to use.
sizeThe size of the font.
Otter.Text.Text ( string  str,
Font  font,
int  size = 16 
)

Create a new Text object.

Parameters
strThe string to display.
fontThe Font to use.
sizeThe size of the font.
Otter.Text.Text ( string  str,
int  size = 16 
)

Create a new Text object.

Parameters
strThe string to display.
sizeThe size of the font.
Otter.Text.Text ( int  size = 16)

Create a new Text object.

Parameters
sizeThe size of the font.

Member Function Documentation

void Otter.Text.CenterTextOrigin ( )

Center the Text's origin. This factors in the Text's local bounds.

void Otter.Text.CenterTextOriginX ( )

Center the Text's X origin. This factors in the Text's left bounds.

void Otter.Text.CenterTextOriginY ( )

Center the Text's Y origin. This factors in the Text's top bounds.

override void Otter.Text.Render ( float  x = 0,
float  y = 0 
)
virtual

Draw the Text.

Parameters
xThe X position offset.
yThe Y position offset.

Reimplemented from Otter.Graphic.

override void Otter.Text.UpdateDrawable ( )
protectedvirtual

Updates the internal SFML data for rendering.

Reimplemented from Otter.Graphic.

Member Data Documentation

Color Otter.Text.OutlineColor = Color.Black

The Color of the outline.

TextOutlineQuality Otter.Text.OutlineQuality = TextOutlineQuality.Good

The quality of the outline. Higher quality is more rendering passes!

int Otter.Text.OutlineThickness

The thickness of the outline.

Color Otter.Text.ShadowColor = Color.Black

The color of the text shadow.

int Otter.Text.ShadowX

The X position of the shadow.

int Otter.Text.ShadowY

The Y position of the shadow.

Property Documentation

float Otter.Text.BoundsLeft
get

The left bounds of the Text.

float Otter.Text.BoundsTop
get

The top bounds of the Text.

float Otter.Text.CenterY
get

Get the actual center Y of the Text.

int Otter.Text.FontSize
getset

The font size.

int Otter.Text.Lines
getset

The number of lines in the text.

float Otter.Text.LineSpacing
get

The amount of space between each line of text.

int Otter.Text.Shadow
set

Set both ShadowX and ShadowY.

string Otter.Text.String
getset

The displayed string.

TextStyle Otter.Text.TextStyle
getset

Set the TextStyle (bold, italic, underline.)


The documentation for this class was generated from the following file: