internal OgmoTileLayer(ContentReader reader, OgmoLevel level) : base(reader) { this.TileHeight = reader.ReadInt32(); this.TileWidth = reader.ReadInt32(); int tilesetCount = reader.ReadInt32(); if (tilesetCount > 0) { for (int i = 0; i < tilesetCount; i++) { string tilesetName = reader.ReadString(); OgmoTileset tileset = level.Project.GetTileset(tilesetName); tilesets.Add(tileset.Name, tileset); } } int tileCount = reader.ReadInt32(); if (tileCount > 0) { for (int i = 0; i < tileCount; i++) { tiles.Add(new OgmoTile(reader, this)); } } }
public OgmoMapTileLayer(Point mapSize, Point mapOffset, OgmoTileLayer tileLayer, OgmoTileset tileset) { MapSize = mapSize; MapOffset = mapOffset; TileLayer = tileLayer; Tileset = tileset; }
/// <summary> /// Gets the specified tileset. /// </summary> /// <param name="name">The name of the tileset.</param> /// <returns>Returns the specified tileset if it exists; otherwise, <c>null</c>.</returns> public OgmoTileset GetTileset(string name) { OgmoTileset tileset = null; if (tilesets.TryGetValue(name, out tileset)) { return(tileset); } return(null); }
public Tile(OgmoTile tile, bool useSourceIndex) { this.Tint = Color.White; this.Position = tile.Position; tileset = tile.Tileset; this.Texture = tileset.Texture; if (useSourceIndex) { this.Source = tileset.Sources[tile.SourceIndex]; } else { this.Source = new Rectangle(tile.TextureOffset.X, tile.TextureOffset.Y, tileset.TileWidth, tileset.TileHeight); } }
/// <summary> /// Constructor. /// </summary> /// <param name="tile">The tile as read in from the Ogmo library.</param> /// <param name="useSourceIndex">Not sure.</param> public Tile(OgmoTile tile, bool useSourceIndex) { mTint = Color.White; mPosition = tile.Position; mTileSet = tile.Tileset; mTexture = mTileSet.Texture; if (useSourceIndex) { mSource = mTileSet.Sources[tile.SourceIndex]; } else { mSource = new Rectangle(tile.TextureOffset.X, tile.TextureOffset.Y, mTileSet.TileWidth, mTileSet.TileHeight); } }