using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Penguloon.Scenes; namespace Penguloon.Levels { public class Map { // 18 x 12 public Tile[,] TileMap { get; set; } public int MapWidth { get; private set; } public int MapHeight { get; private set; } public int TileWidth { get; private set; } public int TileHeight { get; private set; } public SceneBase ParentScene { get; set; } public Map(SceneBase parentScene) { this.ParentScene = parentScene; MapWidth = (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth; MapHeight = (int)StaticUIValues.ScreenViewport.Y; TileWidth = MapWidth / 18; TileHeight = MapHeight / 12; } public void Draw(float deltaTime) { for(int y = 0; y < TileMap.GetLength(0); y++) { for (int x = 0; x < TileMap.GetLength(1); x++) { Texture2D tileTexture = ContentManager.GetTileTextureByType(TileMap[y, x].Type); ParentScene.Main.SpriteBatch.Draw(tileTexture, destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight)); } } } public void Update(float deltaTime) { } } public class Tile { public int Type { get; set; } public Direction Direction { get; set; } public Tile(int type, Direction direction) { this.Type = type; this.Direction = direction; } } }