C# Class TiledLib.Map

A full map from Tiled.
Datei anzeigen Open project: GarethIW/LDEngine Class Usage Examples

Public Methods

Method Description
CheckCollision ( Vector2 position ) : bool?
CheckTileCollision ( Vector2 position ) : bool
CheckTileCollisionIntersect ( Vector2 position, Rectangle rect ) : Rectangle?
Draw ( SpriteBatch spriteBatch, Camera gameCamera ) : void

Draws all layers of the map

DrawAsMap ( SpriteBatch spriteBatch, int scale ) : void

Draws all layers of the map

DrawLayer ( SpriteBatch spriteBatch, TiledLib.Layer layer, Camera gameCamera, Vector2 offset, float alpha, Color color ) : void

Draws a single layer of the map

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera ) : void

Draws a single layer by layer name

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Color color ) : void

Draws a single layer by layer name, with a specified color

DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Vector2 shadowOffset, float alpha ) : void

Draws a single layer as shadows, by layer name

GetLayer ( string name ) : TiledLib.Layer

Gets a layer by name.

Map ( Microsoft.Xna.Framework.Content.ContentManager content, string mapName ) : System
UnloadContent ( ) : void

Private Methods

Method Description
Map ( Microsoft.Xna.Framework.Content.ContentReader reader ) : System

Method Details

CheckCollision() public method

public CheckCollision ( Vector2 position ) : bool?
position Vector2
return bool?

CheckTileCollision() public method

public CheckTileCollision ( Vector2 position ) : bool
position Vector2
return bool

CheckTileCollisionIntersect() public method

public CheckTileCollisionIntersect ( Vector2 position, Rectangle rect ) : Rectangle?
position Vector2
rect Microsoft.Xna.Framework.Rectangle
return Rectangle?

Draw() public method

Draws all layers of the map
public Draw ( SpriteBatch spriteBatch, Camera gameCamera ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the map.
gameCamera Camera The camera to use for positioning.
return void

DrawAsMap() public method

Draws all layers of the map
public DrawAsMap ( SpriteBatch spriteBatch, int scale ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the map.
scale int
return void

DrawLayer() public method

Draws a single layer of the map
public DrawLayer ( SpriteBatch spriteBatch, TiledLib.Layer layer, Camera gameCamera, Vector2 offset, float alpha, Color color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layer TiledLib.Layer
gameCamera Camera The camera to use for positioning.
offset Vector2 A pixel amount to offset the tile positioning by
alpha float Layer opacity.
color Color The color to use when drawing.
return void

DrawLayer() public method

Draws a single layer by layer name
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
return void

DrawLayer() public method

Draws a single layer by layer name, with a specified color
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Color color ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
color Color
return void

DrawLayer() public method

Draws a single layer as shadows, by layer name
public DrawLayer ( SpriteBatch spriteBatch, string layerName, Camera gameCamera, Vector2 shadowOffset, float alpha ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to use to render the layer.
layerName string The name of the layer to draw.
gameCamera Camera The camera to use for positioning.
shadowOffset Vector2 Pixel amount to offset the shadowing by.
alpha float Shadow opacity
return void

GetLayer() public method

Gets a layer by name.
public GetLayer ( string name ) : TiledLib.Layer
name string The name of the layer to retrieve.
return TiledLib.Layer

Map() public method

public Map ( Microsoft.Xna.Framework.Content.ContentManager content, string mapName ) : System
content Microsoft.Xna.Framework.Content.ContentManager
mapName string
return System

UnloadContent() public method

public UnloadContent ( ) : void
return void