/// <param name="tileSize">Pixel size of the tile that is going to be rendered</param> /// <param name="spriteSize">Pixel size of the sprite sizes in sprite sheet</param> public TileMap(Texture spriteSheet, string[] map, int tileSize = 64, int spriteSize = 32) { TileMap._spriteSheet = spriteSheet; this.tiles = new List <Ground>(); this._compoundTile = new CompoundTile(); this.tileSize = tileSize; this.spriteSize = spriteSize; ParseMap(map); }
/// <summary> /// Ensures that vertex array has enough space /// </summary> /// <param name="v">Size of the visible area</param> private void SetSize(Vector2f v) { var w = (int)(v.X / tileSize); var h = (int)(v.Y / tileSize); _compoundTile = new CompoundTile(); //Console.WriteLine($"screen Width: {v.X}, Height: {v.Y}"); if (w == width && h == height) { return; } //Console.WriteLine($"Width: {w}, Height: {h}"); // First time initialization width = w; height = h; tiles = new List <Ground>(width * height); obstacles = new List <Obstacle>(width * height); LoadTiles(0, 0); Refresh(); }