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

Base abstract class used for anything that can be rendered. More...

Inherited by Otter.Decals, Otter.Gradient, Otter.GraphicList, Otter.Grid, Otter.Image, Otter.NineSlice, Otter.RichText, Otter.SquareClock, Otter.Text, Otter.Tilemap, and Otter.Vertices.

Public Member Functions

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...
 
virtual void Render (float x=0, float y=0)
 Draws the graphic. More...
 

Public Attributes

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

void Append (float x, float y, Color color, float u, float v)
 
void Append (float x, float y, Color color=null)
 
virtual void UpdateDrawable ()
 Updates the internal SFML data for rendering. More...
 
virtual void TextureChanged ()
 
virtual void SFMLRender (Drawable drawable, float x=0, float y=0)
 

Protected Attributes

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...
 

Properties

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...
 

Detailed Description

Base abstract class used for anything that can be rendered.

Member Function Documentation

virtual void Otter.Graphic.CenterOrigin ( )
virtual

Centers the graphic origin.

Reimplemented in Otter.RichText.

virtual void Otter.Graphic.CenterOriginZero ( )
virtual

Centers the graphic origin while retaining its relative position.

virtual void Otter.Graphic.ClearShader ( )
virtual

Removes the shader from the graphic.

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

Draws the graphic.

Parameters
xthe x offset to draw the image from
ythe y offset to draw the image from

Reimplemented in Otter.NineSlice, Otter.Surface, Otter.Text, and Otter.GraphicList.

void Otter.Graphic.SetOrigin ( float  x,
float  y 
)

Set the origin of the Graphic.

Parameters
xThe X origin.
yThe Y origin.
void Otter.Graphic.SetOrigin ( Vector2  xy)

Set the origin of the Graphic.

Parameters
xyThe X,Y position of the origin.
void Otter.Graphic.SetPosition ( float  x,
float  y 
)

Set the position of the Graphic.

Parameters
xThe X Position.
yThe Y Position.
void Otter.Graphic.SetPosition ( Graphic  g,
float  offsetX = 0,
float  offsetY = 0 
)

Set the position of the Graphic.

Parameters
gThe Graphic to get the position from.
void Otter.Graphic.SetPosition ( Vector2  xy)

Set the position of the Graphic.

Parameters
xyThe Vector2 to get the position from.
void Otter.Graphic.SetTexture ( string  path)

Set the Texture that the Graphic is using (if it is using one.)

Parameters
pathThe path to the Texture to use.
void Otter.Graphic.SetTexture ( Texture  texture)

Set the Texture that the Graphic is using (if it is using one.)

Parameters
textureThe Texture to use.
void Otter.Graphic.SetTexture ( AtlasTexture  atlasTexture)

Set the Texture that the Graphic is using (if it is using one.)

Parameters
atlasTextureThe AtlasTexture to use.
virtual void Otter.Graphic.Update ( )
virtual

Update the graphic.

Reimplemented in Otter.RichText, Otter.Spritemap< TAnimType >, and Otter.GraphicList.

virtual void Otter.Graphic.UpdateDrawable ( )
protectedvirtual

Updates the internal SFML data for rendering.

Reimplemented in Otter.RichText, Otter.Tilemap, Otter.NineSlice, Otter.Image, Otter.Text, Otter.Vertices, Otter.Decals, Otter.Grid, Otter.SquareClock, and Otter.Gradient.

Member Data Documentation

Rectangle Otter.Graphic.AtlasRegion

The Rectangle to render an AtlasTexture with.

BlendMode Otter.Graphic.Blend = BlendMode.Alpha

The blend mode to be applied to this graphic.

bool Otter.Graphic.Dynamic
protected

If true the graphic will always update its drawable.

string Otter.Graphic.Name = "Graphic"

The name of the graphic.

bool Otter.Graphic.Relative = true

Determines if the Graphic is rendered relative to its Entity.

bool Otter.Graphic.RepeatX

Determines if the image should be rendered multiple times horizontally.

bool Otter.Graphic.RepeatY

Determines if the image should be rendered multiple times vertically.

float Otter.Graphic.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.)

float Otter.Graphic.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.)

Shader Otter.Graphic.Shader

The shader to be applied to this graphic.

float Otter.Graphic.ShakeX

The horizontal amount to randomly offset the graphic by each frame.

float Otter.Graphic.ShakeY

The vertial amount to randomly offset the graphic by each frame.

Rectangle Otter.Graphic.TextureRegion

The region to render the Texture with.

bool Otter.Graphic.Visible = true

Determines if the Graphic will render.

Property Documentation

float Otter.Graphic.Alpha
getset

The base transparency of the graphic. A shortcut to access the base color's Alpha.

float Otter.Graphic.Angle
getset

The angle of rotation of the graphic. Used in the final transformation.

float Otter.Graphic.Bottom
get

The Y position of the bottom of the Graphic.

Color Otter.Graphic.Color
getset

The base color of the Graphic. Multiplies the vertices of the graphic by this color.

float Otter.Graphic.HalfHeight
get

Half of the height.

float Otter.Graphic.HalfWidth
get

Half of the width.

int Otter.Graphic.Height
getset

The height of the Graphic.

float Otter.Graphic.Left
get

The X position of the left side of the Graphic.

float Otter.Graphic.OriginX
getset

The X origin point to scale and rotate the graphic with. Used in the final transformation.

float Otter.Graphic.OriginY
getset

The Y origin point to scale and rotate the graphic with. Used in the final transformation.

bool Otter.Graphic.Repeat
set

Sets both RepeatX and RepeatY at the same time.

float Otter.Graphic.Right
get

The X position of the right side of the Graphic.

float Otter.Graphic.Scale
set

Sets both the ScaleX and ScaleY at the same time.

float Otter.Graphic.ScaledHeight
getset

The height in pixels of the image after applying the Y scale.

float Otter.Graphic.ScaledWidth
getset

The width in pixels of the image after applying the X scale.

float Otter.Graphic.ScaleX
getset

The horizontal scale of the graphic. Used in the final transformation.

float Otter.Graphic.ScaleY
getset

The vertical scale of the graphic. Used in the final transformation.

float Otter.Graphic.Scroll
getset

Set both ScrollX and ScrollY.

float Otter.Graphic.Shake
set

A shortcut to set both ShakeX and ShakeY.

virtual bool Otter.Graphic.Smooth
getset

Smooth the texture of a sprite image while scaling it.

virtual Texture Otter.Graphic.Texture
getset

The texture that the graphic is using.

int Otter.Graphic.TextureBottom
get

The Y position of the bottom of the Texture.

int Otter.Graphic.TextureLeft
get

The X position of the left of the Texture.

int Otter.Graphic.TextureRight
get

The X position of the right of the Texture.

int Otter.Graphic.TextureTop
get

The Y position of the top of the Texture.

float Otter.Graphic.Top
get

The Y position of the top of the Graphic.

int Otter.Graphic.Width
getset

The width of the Graphic.

float Otter.Graphic.X
getset

The X position of the Graphic.

float Otter.Graphic.Y
getset

The Y position of the Graphic.


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