C# Class BrashMonkeyContentPipelineExtension.SpritePacker

Helper for arranging many small sprites into a single larger sheet.
Datei anzeigen Open project: NowSayPillow/xnaBrashSpriter Class Usage Examples

Public Methods

Method Description
PackSprites ( IList p_sourceSprites, ICollection p_outputSprites, ContentProcessorContext p_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 p_a, ArrangedSprite p_b ) : int

Comparison function for sorting sprites by their original indices.

CompareSpriteSizes ( ArrangedSprite p_a, ArrangedSprite p_b ) : int

Comparison function for sorting sprites by size.

CopySpritesToOutput ( List p_sprites, IList p_sourceSprites, ICollection p_outputSprites, int p_width, int p_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 p_sprites, int p_index, int p_x, int p_y ) : int

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

GuessOutputWidth ( List p_sprites ) : int

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

PositionSprite ( List p_sprites, int p_index, int p_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 p_sourceSprites, ICollection p_outputSprites, ContentProcessorContext p_context ) : Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent
p_sourceSprites IList
p_outputSprites ICollection
p_context ContentProcessorContext
return Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent