C# Class Nez.Sprites.Sprite

the most basic and common Renderable. Renders a Subtexture/Texture.
Inheritance: RenderableComponent
ファイルを表示 Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
spriteEffects SpriteEffects

Protected Properties

Property Type Description
_origin Microsoft.Xna.Framework.Vector2
_subtexture Nez.Textures.Subtexture

Public Methods

Method Description
Sprite ( ) : Nez.Textures
Sprite ( Subtexture subtexture ) : Nez.Textures
Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Nez.Textures
drawOutline ( Graphics graphics, Camera camera, Microsoft.Xna.Framework.Color outlineColor, int offset = 1 ) : void
drawOutline ( Graphics graphics, Camera camera, int offset = 1 ) : void

Draws the Renderable with an outline. Note that this should be called on disabled Renderables since they shouldnt take part in default rendering if they need an ouline.

render ( Graphics graphics, Camera camera ) : void
setOrigin ( Vector2 origin ) : Sprite

sets the origin for the Renderable

setOriginNormalized ( Vector2 value ) : Sprite

helper for setting the origin in normalized fashion (0-1 for x and y)

setSubtexture ( Subtexture subtexture ) : Sprite

sets the Subtexture and updates the origin of the Sprite to match Subtexture.origin. If for whatever reason you need an origin different from the Subtexture either clone it or set the origin AFTER setting the Subtexture here.

Method Details

Sprite() public method

public Sprite ( ) : Nez.Textures
return Nez.Textures

Sprite() public method

public Sprite ( Subtexture subtexture ) : Nez.Textures
subtexture Nez.Textures.Subtexture
return Nez.Textures

Sprite() public method

public Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Nez.Textures
texture Microsoft.Xna.Framework.Graphics.Texture2D
return Nez.Textures

drawOutline() public method

public drawOutline ( Graphics graphics, Camera camera, Microsoft.Xna.Framework.Color outlineColor, int offset = 1 ) : void
graphics Graphics
camera Camera
outlineColor Microsoft.Xna.Framework.Color
offset int
return void

drawOutline() public method

Draws the Renderable with an outline. Note that this should be called on disabled Renderables since they shouldnt take part in default rendering if they need an ouline.
public drawOutline ( Graphics graphics, Camera camera, int offset = 1 ) : void
graphics Graphics Graphics.
camera Camera Camera.
offset int Offset.
return void

render() public method

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
return void

setOrigin() public method

sets the origin for the Renderable
public setOrigin ( Vector2 origin ) : Sprite
origin Microsoft.Xna.Framework.Vector2 Origin.
return Sprite

setOriginNormalized() public method

helper for setting the origin in normalized fashion (0-1 for x and y)
public setOriginNormalized ( Vector2 value ) : Sprite
value Microsoft.Xna.Framework.Vector2
return Sprite

setSubtexture() public method

sets the Subtexture and updates the origin of the Sprite to match Subtexture.origin. If for whatever reason you need an origin different from the Subtexture either clone it or set the origin AFTER setting the Subtexture here.
public setSubtexture ( Subtexture subtexture ) : Sprite
subtexture Nez.Textures.Subtexture Subtexture.
return Sprite

Property Details

_origin protected_oe property

protected Vector2,Microsoft.Xna.Framework _origin
return Microsoft.Xna.Framework.Vector2

_subtexture protected_oe property

protected Subtexture,Nez.Textures _subtexture
return Nez.Textures.Subtexture

spriteEffects public_oe property

Batchers passed along to the Batcher when rendering. flipX/flipY are helpers for setting this.
public SpriteEffects spriteEffects
return SpriteEffects