Barotrauma Client Doc
Barotrauma.SpriteSheet Class Reference
Inheritance diagram for Barotrauma.SpriteSheet:
Barotrauma.Sprite Barotrauma.Sprite

Public Member Functions

 SpriteSheet (ContentXElement element, string path="", string file="")
 
 SpriteSheet (string filePath, int columnCount, int rowCount, Vector2 origin, Rectangle? sourceRect=null)
 
override void Draw (ISpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect=SpriteEffects.None, float? depth=default(float?))
 
void Draw (ISpriteBatch spriteBatch, int spriteIndex, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect=SpriteEffects.None, float? depth=default(float?))
 
- Public Member Functions inherited from Barotrauma.Sprite
override string ToString ()
 
 Sprite (ContentXElement element, string path="", string file="", bool lazyLoad=false)
 
 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. More...
 
bool ParseTexturePath (string path="", string file="")
 
 Sprite (Sprite other)
 
 Sprite (Texture2D texture, Rectangle? sourceRectangle, Vector2? newOffset, float newRotation=0.0f, string path=null)
 
async Task LazyLoadAsync ()
 
void EnsureLazyLoaded (bool isAsync=false)
 
void ReloadTexture ()
 
void Draw (ISpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect=SpriteEffects.None)
 
void Draw (ISpriteBatch spriteBatch, Vector2 pos, Color color, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect=SpriteEffects.None, float? depth=null)
 
void Draw (ISpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect=SpriteEffects.None, float? depth=null)
 
void DrawSilhouette (SpriteBatch spriteBatch, Vector2 pos, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect=SpriteEffects.None, float? depth=null)
 Creates a silhouette for the sprite (or outline if the sprite is rendered on top of it) More...
 
void DrawTiled (ISpriteBatch spriteBatch, Vector2 position, Vector2 targetSize, float rotation=0f, Vector2? origin=null, Color? color=null, Vector2? startOffset=null, Vector2? textureScale=null, float? depth=null, SpriteEffects? spriteEffects=null)
 

Properties

int FrameCount [get]
 
Point FrameSize [get]
 
- Properties inherited from Barotrauma.Sprite
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! More...
 
bool LazyLoad [get]
 
Rectangle SourceRect [get, set]
 
float Depth [get, set]
 
Vector2 Origin [get, set]
 In pixels More...
 
Vector2 RelativeOrigin [get, set]
 0 - 1 More...
 
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. More...
 
string Name [get, set]
 
Identifier Identifier [get]
 
static IEnumerable< SpriteLoadedSprites [get]
 
Texture2D texture [get]
 
Texture2D Texture [get]
 
bool Loaded [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from Barotrauma.Sprite
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 :) More...
 
static Texture2D LoadTexture (string file, bool compress=true, ContentPackage contentPackage=null)
 
- Public Attributes inherited from Barotrauma.Sprite
Vector2 size = Vector2.One
 
float rotation
 
SpriteEffects effects = SpriteEffects.None
 
- Static Public Attributes inherited from Barotrauma.Sprite
static readonly Version LastBrokenTiledSpriteGameVersion = new Version(major: 1, minor: 2, build: 7, revision: 0)
 Last version of the game that had broken handling of sprites that were scaled, flipped and offset More...
 
- Protected Attributes inherited from Barotrauma.Sprite
Vector2 offset
 
Vector2 origin
 
float depth
 
volatile bool loadingAsync = false
 

Detailed Description

Constructor & Destructor Documentation

◆ SpriteSheet() [1/2]

Barotrauma.SpriteSheet.SpriteSheet ( ContentXElement  element,
string  path = "",
string  file = "" 
)

◆ SpriteSheet() [2/2]

Barotrauma.SpriteSheet.SpriteSheet ( string  filePath,
int  columnCount,
int  rowCount,
Vector2  origin,
Rectangle?  sourceRect = null 
)

Member Function Documentation

◆ Draw() [1/2]

void Barotrauma.SpriteSheet.Draw ( ISpriteBatch  spriteBatch,
int  spriteIndex,
Vector2  pos,
Color  color,
Vector2  origin,
float  rotate,
Vector2  scale,
SpriteEffects  spriteEffect = SpriteEffects.None,
float?  depth = default(float?) 
)

◆ Draw() [2/2]

override void Barotrauma.SpriteSheet.Draw ( ISpriteBatch  spriteBatch,
Vector2  pos,
Color  color,
Vector2  origin,
float  rotate,
Vector2  scale,
SpriteEffects  spriteEffect = SpriteEffects.None,
float?  depth = default(float?) 
)
virtual

Reimplemented from Barotrauma.Sprite.

Definition at line 8 of file BarotraumaClient/ClientSource/Sprite/SpriteSheet.cs.

Property Documentation

◆ FrameCount

int Barotrauma.SpriteSheet.FrameCount
get

◆ FrameSize

Point Barotrauma.SpriteSheet.FrameSize
get