C# Class FlatRedBall.TileGraphics.MapDrawableBatch

Inheritance: FlatRedBall.PositionedObject, IDrawableBatch
Mostrar archivo Open project: vchelaru/FlatRedBall Class Usage Examples

Protected Properties

Property Type Description
mIndices int[]
mIndices short[]
mTexture Microsoft.Xna.Framework.Graphics.Texture2D
mTileset Tileset
mVertices Microsoft.Xna.Framework.Graphics.VertexPositionTexture[]

Private Properties

Property Type Description
FromReducedLayer MapDrawableBatch
FromReducedLayer MapDrawableBatch
GetRenderingIndexValues void
PrepareRenderingStates Microsoft.Xna.Framework.Graphics.Effect
RegisterName void
VerifySingleTexture void

Public Methods

Method Description
AddTile ( Vector3 bottomLeftPosition, Vector2 dimensions, Vector4 texture ) : int

Adds a tile to the tile map

AddTile ( Vector3 bottomLeftPosition, Vector2 tileDimensions, int textureTopLeftX, int textureTopLeftY, int textureBottomRightX, int textureBottomRightY ) : int

Add a tile to the map

AddTile ( Vector3 bottomLeftPosition, Vector2 dimensions, Vector4 texture ) : void

Adds a tile to the tile map

AddTile ( Vector3 bottomLeftPosition, Vector2 tileDimensions, int textureTopLeftX, int textureTopLeftY, int textureBottomRightX, int textureBottomRightY ) : void

Add a tile to the map

AddToManagers ( ) : void
AddToManagers ( Layer layer ) : void
ApplyDiagonalFlip ( int orderedTileIndex ) : void
Clone ( ) : MapDrawableBatch
Destroy ( ) : void

Don't call this, instead call SpriteManager.RemoveDrawableBatch

Draw ( Camera camera ) : void

Custom drawing technique - sets graphics states and draws the custom shape

FromScnx ( string sceneFileName, string contentManagerName, bool verifySameTexturePerLayer ) : MapDrawableBatch
FromSpriteSaves ( List spriteSaveList, int startingIndex, int count, string contentManagerName, bool verifySameTexturesPerLayer ) : MapDrawableBatch
GetBottomLeftWorldCoordinateForOrderedTile ( int orderedTileIndex, float &x, float &y ) : void
GetFirstAfterX ( VertexPositionTexture list, float xGreaterThan ) : int
GetFirstAfterY ( VertexPositionTexture list, float yGreaterThan ) : int
GetTextureCoordiantesForOrderedTile ( int orderedTileIndex, float &textureX, float &textureY ) : void
MapDrawableBatch ( ) : System
MapDrawableBatch ( int numberOfTiles, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System
MapDrawableBatch ( int numberOfTiles, int textureTileDimensionWidth, int textureTileDimensionHeight, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System

Create and initialize all assets

MergeOntoThis ( IEnumerable mapDrawableBatches ) : void
PaintTile ( int orderedTileIndex, int newTextureId ) : void

Paints a texture on a tile. This method takes the index of the Sprite in the order it was added to the MapDrawableBatch, so it supports any configuration including non-rectangular maps and maps with gaps.

PaintTile ( int row, int column, int newTextureId ) : void

Paints a texture on a tile. This method assumes that the MapDrawableBatch is a perfect recangle with no gaps, and that all tiles have been added left to right, top to bottom.

PaintTileTextureCoordinates ( int orderedTileIndex, float textureXCoordinate, float textureYCoordinate ) : void
Paste ( Sprite sprite, bool setZTo0 ) : int
Paste ( SpriteSave spriteSave, bool setZTo0 ) : int
Paste ( Sprite sprite ) : void
Paste ( SpriteSave spriteSave ) : void
RemoveQuads ( IEnumerable quadIndexes ) : void
RotateTextureCoordinatesCounterclockwise ( int orderedTileIndex ) : void
Update ( ) : void

Here we update our batch - but this batch doesn't need to be updated

Protected Methods

Method Description
InternalInitialize ( ) : void

Private Methods

Method Description
FromReducedLayer ( TMXGlueLib reducedLayerInfo, LayeredTileMap owner, TMXGlueLib rtmi, string contentManagerName ) : MapDrawableBatch
FromReducedLayer ( TMXGlueLib reducedLayerInfo, string contentManagerName, int tileDimensionWidth, int tileDimensionHeight, float quadWidth, float quadHeight ) : MapDrawableBatch
GetRenderingIndexValues ( Camera camera, int &firstVertIndex, int &lastVertIndex, int &indexStart, int &numberOfTriangles ) : void
PrepareRenderingStates ( Camera camera, TextureAddressMode &oldTextureAddressMode ) : Effect
RegisterName ( string name, int tileIndex ) : void
VerifySingleTexture ( List spriteSaveList, int startingIndex, int count ) : void

Method Details

AddTile() public method

Adds a tile to the tile map
public AddTile ( Vector3 bottomLeftPosition, Vector2 dimensions, Vector4 texture ) : int
bottomLeftPosition Vector3
dimensions Vector2
texture Vector4 /// 4 points defining the boundaries in the texture for the tile. /// (X = left, Y = right, Z = top, W = bottom) ///
return int

AddTile() public method

Add a tile to the map
public AddTile ( Vector3 bottomLeftPosition, Vector2 tileDimensions, int textureTopLeftX, int textureTopLeftY, int textureBottomRightX, int textureBottomRightY ) : int
bottomLeftPosition Vector3
tileDimensions Vector2
textureTopLeftX int Top left X coordinate in the core texture
textureTopLeftY int Top left Y coordinate in the core texture
textureBottomRightX int Bottom right X coordinate in the core texture
textureBottomRightY int Bottom right Y coordinate in the core texture
return int

AddTile() public method

Adds a tile to the tile map
public AddTile ( Vector3 bottomLeftPosition, Vector2 dimensions, Vector4 texture ) : void
bottomLeftPosition Vector3
dimensions Vector2
texture Vector4 /// 4 points defining the boundaries in the texture for the tile. /// (X = left, Y = right, Z = top, W = bottom) ///
return void

AddTile() public method

Add a tile to the map
public AddTile ( Vector3 bottomLeftPosition, Vector2 tileDimensions, int textureTopLeftX, int textureTopLeftY, int textureBottomRightX, int textureBottomRightY ) : void
bottomLeftPosition Vector3
tileDimensions Vector2
textureTopLeftX int Top left X coordinate in the core texture
textureTopLeftY int Top left Y coordinate in the core texture
textureBottomRightX int Bottom right X coordinate in the core texture
textureBottomRightY int Bottom right Y coordinate in the core texture
return void

AddToManagers() public method

public AddToManagers ( ) : void
return void

AddToManagers() public method

public AddToManagers ( Layer layer ) : void
layer Layer
return void

ApplyDiagonalFlip() public method

public ApplyDiagonalFlip ( int orderedTileIndex ) : void
orderedTileIndex int
return void

Clone() public method

public Clone ( ) : MapDrawableBatch
return MapDrawableBatch

Destroy() public method

Don't call this, instead call SpriteManager.RemoveDrawableBatch
public Destroy ( ) : void
return void

Draw() public method

Custom drawing technique - sets graphics states and draws the custom shape
public Draw ( Camera camera ) : void
camera FlatRedBall.Camera The currently drawing camera
return void

FromScnx() public static method

public static FromScnx ( string sceneFileName, string contentManagerName, bool verifySameTexturePerLayer ) : MapDrawableBatch
sceneFileName string
contentManagerName string
verifySameTexturePerLayer bool
return MapDrawableBatch

FromSpriteSaves() public static method

public static FromSpriteSaves ( List spriteSaveList, int startingIndex, int count, string contentManagerName, bool verifySameTexturesPerLayer ) : MapDrawableBatch
spriteSaveList List
startingIndex int
count int
contentManagerName string
verifySameTexturesPerLayer bool
return MapDrawableBatch

GetBottomLeftWorldCoordinateForOrderedTile() public method

public GetBottomLeftWorldCoordinateForOrderedTile ( int orderedTileIndex, float &x, float &y ) : void
orderedTileIndex int
x float
y float
return void

GetFirstAfterX() public static method

public static GetFirstAfterX ( VertexPositionTexture list, float xGreaterThan ) : int
list Microsoft.Xna.Framework.Graphics.VertexPositionTexture
xGreaterThan float
return int

GetFirstAfterY() public static method

public static GetFirstAfterY ( VertexPositionTexture list, float yGreaterThan ) : int
list Microsoft.Xna.Framework.Graphics.VertexPositionTexture
yGreaterThan float
return int

GetTextureCoordiantesForOrderedTile() public method

public GetTextureCoordiantesForOrderedTile ( int orderedTileIndex, float &textureX, float &textureY ) : void
orderedTileIndex int
textureX float
textureY float
return void

InternalInitialize() protected method

protected InternalInitialize ( ) : void
return void

MapDrawableBatch() public method

public MapDrawableBatch ( ) : System
return System

MapDrawableBatch() public method

public MapDrawableBatch ( int numberOfTiles, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System
numberOfTiles int
texture Microsoft.Xna.Framework.Graphics.Texture2D
return System

MapDrawableBatch() public method

Create and initialize all assets
public MapDrawableBatch ( int numberOfTiles, int textureTileDimensionWidth, int textureTileDimensionHeight, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : System
numberOfTiles int
textureTileDimensionWidth int
textureTileDimensionHeight int
texture Microsoft.Xna.Framework.Graphics.Texture2D
return System

MergeOntoThis() public method

public MergeOntoThis ( IEnumerable mapDrawableBatches ) : void
mapDrawableBatches IEnumerable
return void

PaintTile() public method

Paints a texture on a tile. This method takes the index of the Sprite in the order it was added to the MapDrawableBatch, so it supports any configuration including non-rectangular maps and maps with gaps.
public PaintTile ( int orderedTileIndex, int newTextureId ) : void
orderedTileIndex int The index of the tile to paint - this matches the index of the tile as it was added.
newTextureId int
return void

PaintTile() public method

Paints a texture on a tile. This method assumes that the MapDrawableBatch is a perfect recangle with no gaps, and that all tiles have been added left to right, top to bottom.
public PaintTile ( int row, int column, int newTextureId ) : void
row int The row (y) index, base 0
column int The column (x) index, base 0
newTextureId int The texture ID, which is a left to right, top to bottom index
return void

PaintTileTextureCoordinates() public method

public PaintTileTextureCoordinates ( int orderedTileIndex, float textureXCoordinate, float textureYCoordinate ) : void
orderedTileIndex int
textureXCoordinate float
textureYCoordinate float
return void

Paste() public method

public Paste ( Sprite sprite, bool setZTo0 ) : int
sprite Sprite
setZTo0 bool
return int

Paste() public method

public Paste ( SpriteSave spriteSave, bool setZTo0 ) : int
spriteSave SpriteSave
setZTo0 bool
return int

Paste() public method

public Paste ( Sprite sprite ) : void
sprite Sprite
return void

Paste() public method

public Paste ( SpriteSave spriteSave ) : void
spriteSave SpriteSave
return void

RemoveQuads() public method

public RemoveQuads ( IEnumerable quadIndexes ) : void
quadIndexes IEnumerable
return void

RotateTextureCoordinatesCounterclockwise() public method

public RotateTextureCoordinatesCounterclockwise ( int orderedTileIndex ) : void
orderedTileIndex int
return void

Update() public method

Here we update our batch - but this batch doesn't need to be updated
public Update ( ) : void
return void

Property Details

mIndices protected_oe property

The indices to draw the shape
protected int[] mIndices
return int[]

mIndices protected_oe property

The indices to draw the shape
protected short[] mIndices
return short[]

mTexture protected_oe property

protected Texture2D,Microsoft.Xna.Framework.Graphics mTexture
return Microsoft.Xna.Framework.Graphics.Texture2D

mTileset protected_oe property

protected Tileset,FlatRedBall.TileGraphics mTileset
return Tileset

mVertices protected_oe property

The vertices used to draw the map.
Coordinate order is: 3 2 0 1
protected VertexPositionTexture[],Microsoft.Xna.Framework.Graphics mVertices
return Microsoft.Xna.Framework.Graphics.VertexPositionTexture[]