Barotrauma Server
Loading...
Searching...
No Matches
Barotrauma.Sprite Class Reference
Inheritance diagram for Barotrauma.Sprite:
Barotrauma.SpriteSheet

Public Member Functions

override string ToString ()
 
 Sprite (ContentXElement element, string path="", string file="", bool lazyLoad=false, float sourceRectScale=1)
 
 Sprite (string newFile, Vector2 newOrigin)
 
 Sprite (string newFile, Rectangle? sourceRectangle, Vector2? origin=null, float rotation=0)
 
void Remove ()
 
void ReloadXML ()
 Works only if there is a name attribute defined for the sprite. For items and structures, the entity id or name is used if the sprite's name attribute is not defined.
 
bool ParseTexturePath (string path="", string file="")
 

Static Public Member Functions

static Identifier GetIdentifier (XElement sourceElement)
 Creates a supposedly unique identifier from the parent element. If the parent element is not found, uses the sprite element. TODO: If there are multiple elements with exactly the same data, the ids will fail. -> Is there a better way to identify the sprites? ALSO TODO: delete :)
 

Public Attributes

Vector2 size = Vector2.One
 
float rotation
 

Protected Attributes

Vector2 offset
 
Vector2 origin
 
float depth
 

Properties

ContentXElement SourceElement [get]
 Reference to the xml element from where the sprite was created. Can be null if the sprite was not defined in xml!
 
bool LazyLoad [get]
 
Rectangle SourceRect [get, set]
 
float Depth [get, set]
 
Vector2 Origin [get, set]
 In pixels.
 
Vector2 RelativeOrigin [get, set]
 0 - 1
 
Vector2 RelativeSize [get]
 
ContentPath FilePath [get]
 
string FullPath [get]
 
bool Compress [get]
 
Identifier EntityIdentifier [get, set]
 Identifier of the Map Entity so that we can link the sprite to its owner.
 
string Name [get, set]
 

Constructor & Destructor Documentation

◆ Sprite() [1/3]

Barotrauma.Sprite.Sprite ( ContentXElement element,
string path = "",
string file = "",
bool lazyLoad = false,
float sourceRectScale = 1 )

◆ Sprite() [2/3]

Barotrauma.Sprite.Sprite ( string newFile,
Vector2 newOrigin )

◆ Sprite() [3/3]

Barotrauma.Sprite.Sprite ( string newFile,
Rectangle? sourceRectangle,
Vector2? origin = null,
float rotation = 0 )

Member Function Documentation

◆ GetIdentifier()

static Identifier Barotrauma.Sprite.GetIdentifier ( XElement sourceElement)
static

Creates a supposedly unique identifier from the parent element. If the parent element is not found, uses the sprite element. TODO: If there are multiple elements with exactly the same data, the ids will fail. -> Is there a better way to identify the sprites? ALSO TODO: delete :)

◆ ParseTexturePath()

bool Barotrauma.Sprite.ParseTexturePath ( string path = "",
string file = "" )

◆ ReloadXML()

void Barotrauma.Sprite.ReloadXML ( )

Works only if there is a name attribute defined for the sprite. For items and structures, the entity id or name is used if the sprite's name attribute is not defined.

◆ Remove()

void Barotrauma.Sprite.Remove ( )

◆ ToString()

override string Barotrauma.Sprite.ToString ( )

Member Data Documentation

◆ depth

float Barotrauma.Sprite.depth
protected

◆ offset

Vector2 Barotrauma.Sprite.offset
protected

◆ origin

Vector2 Barotrauma.Sprite.origin
protected

◆ rotation

float Barotrauma.Sprite.rotation

◆ size

Vector2 Barotrauma.Sprite.size = Vector2.One

Property Documentation

◆ Compress

bool Barotrauma.Sprite.Compress
get

◆ Depth

float Barotrauma.Sprite.Depth
getset

◆ EntityIdentifier

Identifier Barotrauma.Sprite.EntityIdentifier
getset

Identifier of the Map Entity so that we can link the sprite to its owner.

◆ FilePath

ContentPath Barotrauma.Sprite.FilePath
get

◆ FullPath

string Barotrauma.Sprite.FullPath
get

◆ LazyLoad

bool Barotrauma.Sprite.LazyLoad
get

◆ Name

string Barotrauma.Sprite.Name
getset

◆ Origin

Vector2 Barotrauma.Sprite.Origin
getset

In pixels.

◆ RelativeOrigin

Vector2 Barotrauma.Sprite.RelativeOrigin
getset

0 - 1

◆ RelativeSize

Vector2 Barotrauma.Sprite.RelativeSize
get

◆ SourceElement

ContentXElement Barotrauma.Sprite.SourceElement
get

Reference to the xml element from where the sprite was created. Can be null if the sprite was not defined in xml!

◆ SourceRect

Rectangle Barotrauma.Sprite.SourceRect
getset

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