C# Класс FuncWorks.XNA.XTiled.Map

An XTiled TMX Map
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
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

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
CreatePolygonTextures ( ) : void
DrawLayer ( SpriteBatch spriteBatch, Int32 layerID, Rectangle &region, Int32 txMin, Int32 txMax, Int32 tyMin, Int32 tyMax, System.Single layerDepth ) : void

Описание методов

Draw() публичный Метод

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
Результат void

Draw() публичный Метод

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
Результат void

DrawLayer() публичный Метод

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
Результат void

DrawMapObject() публичный Метод

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
Результат void

DrawObjectLayer() публичный Метод

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
Результат void

DrawRectangle() публичный статический Метод

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
Результат void

DrawTileObject() публичный Метод

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
Результат void

DrawTileObject() публичный Метод

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
Результат void

GetObjectsInRegion() публичный Метод

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
Результат IEnumerable

GetObjectsInRegion() публичный Метод

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
Результат IEnumerable

GetTilesInRegion() публичный Метод

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
Результат IEnumerable

GetTilesInRegion() публичный Метод

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
Результат IEnumerable

InitObjectDrawing() публичный статический Метод

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
Результат void

Translate() публичный статический Метод

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
Результат Point

Translate() публичный статический Метод

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
Результат Rectangle

Translate() публичный статический Метод

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
Результат Vector2

Translate() публичный статический Метод

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
Результат void

Translate() публичный статический Метод

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
Результат void

Translate() публичный статический Метод

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
Результат void

Описание свойств

Bounds публичное свойство

Size of the map in pixels
public Rectangle,Microsoft.Xna.Framework Bounds
Результат Microsoft.Xna.Framework.Rectangle

Height публичное свойство

Height, in tiles, of the map
public Int32 Height
Результат Int32

LayerOrder публичное свойство

Order of tile and object layers combined, first is the bottom layer
public LayerInfo[] LayerOrder
Результат LayerInfo[]

LoadTextures публичное свойство

True if XTiled loaded tileset textures during map load
public Boolean LoadTextures
Результат Boolean

ObjectLayers публичное свойство

Ordered collection of object layers; first is the bottom layer
public ObjectLayerList ObjectLayers
Результат ObjectLayerList

Orientation публичное свойство

Orientation of the map.
public MapOrientation Orientation
Результат MapOrientation

Properties публичное свойство

Custom properties
public Dictionary Properties
Результат Property>.Dictionary

SourceTiles публичное свойство

List of all source tiles from tilesets
public Tile[] SourceTiles
Результат Tile[]

TileHeight публичное свойство

Pixel height of a single tile
public Int32 TileHeight
Результат Int32

TileLayers публичное свойство

Ordered collection of tile layers; first is the bottom layer
public TileLayerList TileLayers
Результат TileLayerList

TileWidth публичное свойство

Pixel width of a single tile
public Int32 TileWidth
Результат Int32

Tilesets публичное свойство

Tilesets associated with this map
public Tileset[] Tilesets
Результат Tileset[]

Width публичное свойство

Width, in tiles, of the map
public Int32 Width
Результат Int32