C# Class SpriterBetaPipelineExtension.SpritePacker

Helper for arranging many small sprites into a single larger sheet.
Mostrar archivo Open project: schmelze/SpriterXNA

Public Methods

Method Description
PackSprites ( IList sourceSprites, ICollection outputSprites, ContentProcessorContext context ) : Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent

Packs a list of sprites into a single big texture, recording where each one was stored.

Private Methods

Method Description
CompareSpriteIndices ( ArrangedSprite a, ArrangedSprite b ) : int

Comparison function for sorting sprites by their original indices.

CompareSpriteSizes ( ArrangedSprite a, ArrangedSprite b ) : int

Comparison function for sorting sprites by size.

CopySpritesToOutput ( List sprites, IList sourceSprites, ICollection outputSprites, int width, int height ) : Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent

Once the arranging is complete, copies the bitmap data for each sprite to its chosen position in the single larger output bitmap.

FindIntersectingSprite ( List sprites, int index, int x, int y ) : int

Checks if a proposed sprite position collides with anything that we already arranged.

GuessOutputWidth ( List sprites ) : int

Heuristic guesses what might be a good output width for a list of sprites.

PositionSprite ( List sprites, int index, int outputWidth ) : void

Works out where to position a single sprite.

Method Details

PackSprites() public static method

Packs a list of sprites into a single big texture, recording where each one was stored.
public static PackSprites ( IList sourceSprites, ICollection outputSprites, ContentProcessorContext context ) : Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent
sourceSprites IList
outputSprites ICollection
context ContentProcessorContext
return Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent