C# Class FuncWorks.XNA.XTiled.Map

An XTiled TMX Map
Afficher le fichier Open project: Bacon41/PantheonPrototype Class Usage Examples

Méthodes publiques

Свойство Type Description
Bounds Microsoft.Xna.Framework.Rectangle
Height Int32
LayerOrder LayerInfo[]
LoadTextures Boolean
ObjectLayers ObjectLayerList
Orientation MapOrientation
Properties Property>.Dictionary
SourceTiles Tile[]
TileHeight Int32
TileLayers TileLayerList
TileWidth Int32
Tilesets Tileset[]
Width Int32

Méthodes publiques

Méthode Description
Draw ( SpriteBatch spriteBatch, Rectangle region ) : void

Draws all visible tile layers

Draw ( SpriteBatch spriteBatch, Rectangle region, System.Boolean drawHiddenLayers ) : void

Draws all visible tile layers

DrawLayer ( SpriteBatch spriteBatch, Int32 layerID, Rectangle region, System.Single layerDepth ) : void

Draws given tile layer

DrawMapObject ( SpriteBatch spriteBatch, Int32 objectLayerID, Int32 objectID, Rectangle region, System.Single layerDepth ) : void

Method to draw a MapObject

DrawObjectLayer ( SpriteBatch spriteBatch, Int32 objectLayerID, Rectangle region, System.Single layerDepth ) : void

Draws all objects on the given object layer

DrawRectangle ( SpriteBatch spriteBatch, Rectangle rect, Rectangle region, System.Single layerDepth, Color linecolor, Color fillColor ) : void

Method to draw a Rectangle

DrawTileObject ( SpriteBatch spriteBatch, Int32 objectLayerID, Int32 objectID, Rectangle region, System.Single layerDepth, Color color ) : void

Method to draw a MapObject that represents a tile object

DrawTileObject ( SpriteBatch spriteBatch, int objectLayerID, int objectID, Rectangle &region, float layerDepth, Color &color ) : void

Method to draw a MapObject that represents a tile object

GetObjectsInRegion ( Int32 objectLayerID, Rectangle region ) : IEnumerable

Returns a collection of MapObjects inside the given region

GetObjectsInRegion ( Rectangle region ) : IEnumerable

Returns a collection of MapObjects inside the given region

GetTilesInRegion ( Int32 tileLayerID, Rectangle region ) : IEnumerable

Returns a collection of TileData inside the given region

GetTilesInRegion ( Rectangle region ) : IEnumerable

Returns a collection of TileData inside the given region

InitObjectDrawing ( GraphicsDevice graphicsDevice ) : void

Enables rendering of map objects

Translate ( Point location, Rectangle relativeTo ) : Point

Translates a location to screen space

Translate ( Rectangle location, Rectangle relativeTo ) : Rectangle

Translates a location to screen space

Translate ( Vector2 location, Rectangle relativeTo ) : Vector2

Translates a location to screen space

Translate ( Point &location, Rectangle &relativeTo ) : void

Translates a location to screen space

Translate ( Rectangle &location, Rectangle &relativeTo ) : void

Translates a location to screen space

Translate ( Vector2 &location, Rectangle &relativeTo ) : void

Translates a location to screen space

Private Methods

Méthode Description
CreatePolygonTextures ( ) : void
DrawLayer ( SpriteBatch spriteBatch, Int32 layerID, Rectangle &region, Int32 txMin, Int32 txMax, Int32 tyMin, Int32 tyMax, System.Single layerDepth ) : void

Method Details

Draw() public méthode

Draws all visible tile layers
public Draw ( SpriteBatch spriteBatch, Rectangle region ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
Résultat void

Draw() public méthode

Draws all visible tile layers
public Draw ( SpriteBatch spriteBatch, Rectangle region, System.Boolean drawHiddenLayers ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
drawHiddenLayers System.Boolean If true, draws layers regardless of TileLayer.Visible flag
Résultat void

DrawLayer() public méthode

Draws given tile layer
public DrawLayer ( SpriteBatch spriteBatch, Int32 layerID, Rectangle region, System.Single layerDepth ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
layerID System.Int32 Index of the layer to draw in the Map.TileLayers collection
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
layerDepth System.Single LayerDepth value to pass to SpriteBatch
Résultat void

DrawMapObject() public méthode

Method to draw a MapObject
public DrawMapObject ( SpriteBatch spriteBatch, Int32 objectLayerID, Int32 objectID, Rectangle region, System.Single layerDepth ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
objectLayerID System.Int32 Index of the layer to draw in the Map.ObjectLayers collection
objectID System.Int32 Index of the object to draw in the Map.ObjectLayers.MapObjects collection
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
layerDepth System.Single LayerDepth value to pass to SpriteBatch
Résultat void

DrawObjectLayer() public méthode

Draws all objects on the given object layer
public DrawObjectLayer ( SpriteBatch spriteBatch, Int32 objectLayerID, Rectangle region, System.Single layerDepth ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
objectLayerID System.Int32 Index of the layer to draw in the Map.ObjectLayers collection
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
layerDepth System.Single LayerDepth value to pass to SpriteBatch
Résultat void

DrawRectangle() public static méthode

Method to draw a Rectangle
public static DrawRectangle ( SpriteBatch spriteBatch, Rectangle rect, Rectangle region, System.Single layerDepth, Color linecolor, Color fillColor ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
rect Microsoft.Xna.Framework.Rectangle The Rectangle to draw, in map pixels
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels currently visible
layerDepth System.Single LayerDepth value to pass to SpriteBatch
linecolor Color Color of the Rectangle border
fillColor Color Color to fill the Rectangle with
Résultat void

DrawTileObject() public méthode

Method to draw a MapObject that represents a tile object
public DrawTileObject ( SpriteBatch spriteBatch, Int32 objectLayerID, Int32 objectID, Rectangle region, System.Single layerDepth, Color color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
objectLayerID System.Int32 Index of the layer to draw in the Map.ObjectLayers collection
objectID System.Int32 Index of the object to draw in the Map.ObjectLayers.MapObjects collection
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
layerDepth System.Single LayerDepth value to pass to SpriteBatch
color Color Color of the object
Résultat void

DrawTileObject() public méthode

Method to draw a MapObject that represents a tile object
public DrawTileObject ( SpriteBatch spriteBatch, int objectLayerID, int objectID, Rectangle &region, float layerDepth, Color &color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch XNA SpriteBatch instance; SpriteBatch.Begin() must be called before using this method
objectLayerID int Index of the layer to draw in the Map.ObjectLayers collection
objectID int Index of the object to draw in the Map.ObjectLayers.MapObjects collection
region Microsoft.Xna.Framework.Rectangle Region of the map in pixels to draw
layerDepth float LayerDepth value to pass to SpriteBatch
color Color Color of the object
Résultat void

GetObjectsInRegion() public méthode

Returns a collection of MapObjects inside the given region
public GetObjectsInRegion ( Int32 objectLayerID, Rectangle region ) : IEnumerable
objectLayerID System.Int32 The object layer to check
region Microsoft.Xna.Framework.Rectangle The region, in pixles, to check
Résultat IEnumerable

GetObjectsInRegion() public méthode

Returns a collection of MapObjects inside the given region
public GetObjectsInRegion ( Rectangle region ) : IEnumerable
region Microsoft.Xna.Framework.Rectangle The region, in pixles, to check
Résultat IEnumerable

GetTilesInRegion() public méthode

Returns a collection of TileData inside the given region
public GetTilesInRegion ( Int32 tileLayerID, Rectangle region ) : IEnumerable
tileLayerID System.Int32 The tile layer to check
region Microsoft.Xna.Framework.Rectangle The region, in pixles, to check
Résultat IEnumerable

GetTilesInRegion() public méthode

Returns a collection of TileData inside the given region
public GetTilesInRegion ( Rectangle region ) : IEnumerable
region Microsoft.Xna.Framework.Rectangle The region, in pixles, to check
Résultat IEnumerable

InitObjectDrawing() public static méthode

Enables rendering of map objects
public static InitObjectDrawing ( GraphicsDevice graphicsDevice ) : void
graphicsDevice GraphicsDevice The graphics device to us in creating textures to support object rendering
Résultat void

Translate() public static méthode

Translates a location to screen space
public static Translate ( Point location, Rectangle relativeTo ) : Point
location Point The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat Point

Translate() public static méthode

Translates a location to screen space
public static Translate ( Rectangle location, Rectangle relativeTo ) : Rectangle
location Rectangle The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat Rectangle

Translate() public static méthode

Translates a location to screen space
public static Translate ( Vector2 location, Rectangle relativeTo ) : Vector2
location Vector2 The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat Vector2

Translate() public static méthode

Translates a location to screen space
public static Translate ( Point &location, Rectangle &relativeTo ) : void
location Point The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat void

Translate() public static méthode

Translates a location to screen space
public static Translate ( Rectangle &location, Rectangle &relativeTo ) : void
location Rectangle The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat void

Translate() public static méthode

Translates a location to screen space
public static Translate ( Vector2 &location, Rectangle &relativeTo ) : void
location Vector2 The location in map pixel coordinates
relativeTo Rectangle Region of the map that is on screen
Résultat void

Property Details

Bounds public_oe property

Size of the map in pixels
public Rectangle,Microsoft.Xna.Framework Bounds
Résultat Microsoft.Xna.Framework.Rectangle

Height public_oe property

Height, in tiles, of the map
public Int32 Height
Résultat Int32

LayerOrder public_oe property

Order of tile and object layers combined, first is the bottom layer
public LayerInfo[] LayerOrder
Résultat LayerInfo[]

LoadTextures public_oe property

True if XTiled loaded tileset textures during map load
public Boolean LoadTextures
Résultat Boolean

ObjectLayers public_oe property

Ordered collection of object layers; first is the bottom layer
public ObjectLayerList ObjectLayers
Résultat ObjectLayerList

Orientation public_oe property

Orientation of the map.
public MapOrientation Orientation
Résultat MapOrientation

Properties public_oe property

Custom properties
public Dictionary Properties
Résultat Property>.Dictionary

SourceTiles public_oe property

List of all source tiles from tilesets
public Tile[] SourceTiles
Résultat Tile[]

TileHeight public_oe property

Pixel height of a single tile
public Int32 TileHeight
Résultat Int32

TileLayers public_oe property

Ordered collection of tile layers; first is the bottom layer
public TileLayerList TileLayers
Résultat TileLayerList

TileWidth public_oe property

Pixel width of a single tile
public Int32 TileWidth
Résultat Int32

Tilesets public_oe property

Tilesets associated with this map
public Tileset[] Tilesets
Résultat Tileset[]

Width public_oe property

Width, in tiles, of the map
public Int32 Width
Résultat Int32