C# Class Nez.Textures.Subtexture

represents a single element in a texture atlas consisting of a texture and the source rectangle for the frame
Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Свойство Type Description
center Vector2
origin Vector2
sourceRect Microsoft.Xna.Framework.Rectangle
texture2D Microsoft.Xna.Framework.Graphics.Texture2D

Méthodes publiques

Méthode Description
Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Microsoft.Xna.Framework
Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle sourceRect ) : Microsoft.Xna.Framework
Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle sourceRect, Vector2 origin ) : Microsoft.Xna.Framework
Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, float x, float y, float width, float height ) : Microsoft.Xna.Framework

convenience constructor that casts floats to ints for the sourceRect

Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int x, int y, int width, int height ) : Microsoft.Xna.Framework
ToString ( ) : string
clone ( ) : Subtexture

clones the Subtexture

generateNinePatchRects ( Rectangle renderRect, Rectangle destArray, int marginLeft, int marginRight, int marginTop, int marginBottom ) : void

generates nine patch Rectangles. destArray should have 9 elements. renderRect is the final area in which the nine patch will be rendered. To just get the source rects for rendering pass in the Subtexture.sourceRect. Pass in a larger Rectangle to get final destination rendering Rectangles.

subtexturesFromAtlas ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int cellWidth, int cellHeight, int cellOffset, int maxCellsToInclude = int.MaxValue ) : List

provides a List of subtextures given an atlas with equally spaced rows/columns of sprites

Method Details

Subtexture() public méthode

public Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Microsoft.Xna.Framework
texture Microsoft.Xna.Framework.Graphics.Texture2D
Résultat Microsoft.Xna.Framework

Subtexture() public méthode

public Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle sourceRect ) : Microsoft.Xna.Framework
texture Microsoft.Xna.Framework.Graphics.Texture2D
sourceRect Microsoft.Xna.Framework.Rectangle
Résultat Microsoft.Xna.Framework

Subtexture() public méthode

public Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle sourceRect, Vector2 origin ) : Microsoft.Xna.Framework
texture Microsoft.Xna.Framework.Graphics.Texture2D
sourceRect Microsoft.Xna.Framework.Rectangle
origin Vector2
Résultat Microsoft.Xna.Framework

Subtexture() public méthode

convenience constructor that casts floats to ints for the sourceRect
public Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, float x, float y, float width, float height ) : Microsoft.Xna.Framework
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
x float The x coordinate.
y float The y coordinate.
width float Width.
height float Height.
Résultat Microsoft.Xna.Framework

Subtexture() public méthode

public Subtexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int x, int y, int width, int height ) : Microsoft.Xna.Framework
texture Microsoft.Xna.Framework.Graphics.Texture2D
x int
y int
width int
height int
Résultat Microsoft.Xna.Framework

ToString() public méthode

public ToString ( ) : string
Résultat string

clone() public méthode

clones the Subtexture
public clone ( ) : Subtexture
Résultat Subtexture

generateNinePatchRects() public méthode

generates nine patch Rectangles. destArray should have 9 elements. renderRect is the final area in which the nine patch will be rendered. To just get the source rects for rendering pass in the Subtexture.sourceRect. Pass in a larger Rectangle to get final destination rendering Rectangles.
public generateNinePatchRects ( Rectangle renderRect, Rectangle destArray, int marginLeft, int marginRight, int marginTop, int marginBottom ) : void
renderRect Microsoft.Xna.Framework.Rectangle Render rect.
destArray Microsoft.Xna.Framework.Rectangle Destination array.
marginLeft int Margin left.
marginRight int Margin right.
marginTop int Margin top.
marginBottom int Margin bottom.
Résultat void

subtexturesFromAtlas() public static méthode

provides a List of subtextures given an atlas with equally spaced rows/columns of sprites
public static subtexturesFromAtlas ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int cellWidth, int cellHeight, int cellOffset, int maxCellsToInclude = int.MaxValue ) : List
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
cellWidth int Cell width.
cellHeight int Cell height.
cellOffset int the first cell to include while processing. 0 based indexing.
maxCellsToInclude int Max cells to included.
Résultat List

Property Details

center public_oe property

center of the sourceRect if it had a 0,0 origin. This is basically the center in sourceRect-space.
public Vector2 center
Résultat Vector2

origin public_oe property

the origin that a RenderableComponent should use when using this Subtexture. Defaults to the center.
public Vector2 origin
Résultat Vector2

sourceRect public_oe property

rectangle in the Texture2D for this element
public Rectangle,Microsoft.Xna.Framework sourceRect
Résultat Microsoft.Xna.Framework.Rectangle

texture2D public_oe property

the actual Texture2D
public Texture2D,Microsoft.Xna.Framework.Graphics texture2D
Résultat Microsoft.Xna.Framework.Graphics.Texture2D