diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2017-12-11 22:02:13 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2017-12-11 22:02:13 +0100 |
| commit | fd6fa4e5cebbe3edb65d50c78dcc8a97ce98ce64 (patch) | |
| tree | 8950f6b9023e0b47e22e1cd4869ab76de0803f4c /Penguloon/Levels/Map.cs | |
| parent | c4c0f3c887d627b6432551e96009c7aeecd4cdd8 (diff) | |
First commit
Diffstat (limited to 'Penguloon/Levels/Map.cs')
| -rw-r--r-- | Penguloon/Levels/Map.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs new file mode 100644 index 0000000..384d011 --- /dev/null +++ b/Penguloon/Levels/Map.cs @@ -0,0 +1,63 @@ +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; + } + } +}
\ No newline at end of file |
