Bożydar Sobczak avatar Bożydar Sobczak committed 071d299

Refactor: Tile renamed to TileStack

Comments (0)

Files changed (8)

FunctionalRogue.View/BoardScreen.fs

                 let virtualY = y + boardFramePosition.Y
                 let textel = FunctionalRogue.Screen.toTextel board.Places.[virtualX, virtualY] None
                 let tile = 
-                    new Xna.Gui.Controls.Elements.BoardItems.Tile (
+                    new Xna.Gui.Controls.Elements.BoardItems.TileStack (
                         BitmapNames = 
                             [| 
                                 textel.Char.ToString()

xnagui/Xna.Gui.Controls/Elements/Board.cs

             RenderRule = new BoardRenderRule(TileCountX, TileCountY);
         }
 
-        public void PutTile(int x, int y, Tile tile)
+        public void PutTile(int x, int y, TileStack tileStack)
         {
-            RenderRule.Tiles[x, y] = tile;
+            RenderRule.TileStack[x, y] = tileStack;
         }
 
         public override void Layout()

xnagui/Xna.Gui.Controls/Elements/BoardItems/Fire.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace Xna.Gui.Controls.Elements.BoardItems
+{
+    // TODO: This should be one of tiles perspective
+    public class Fire : Tile
+    {
+        private TimeSpan _innerClock = new TimeSpan(0);
+        private int _ticker = 0;
+
+        public void Draw(GameTime gameTime)
+        {
+            _innerClock += gameTime.ElapsedGameTime;
+            if (_innerClock > new TimeSpan(300))
+            {
+                if (_ticker < 3)
+                {
+                    _ticker += 1;
+                }
+                else
+                {
+                    _ticker = 0;
+                }
+            }
+        }
+    }
+}

xnagui/Xna.Gui.Controls/Elements/BoardItems/Tile.cs

 using System;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Xna.Gui.Controls.RenderRules;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
 
 namespace Xna.Gui.Controls.Elements.BoardItems
 {
     public class Tile
     {
-        public string[] BitmapNames;
     }
 }

xnagui/Xna.Gui.Controls/Elements/BoardItems/TileStack.cs

+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Xna.Gui.Controls.RenderRules;
+
+namespace Xna.Gui.Controls.Elements.BoardItems
+{
+    public class TileStack
+    {
+        public string[] BitmapNames;
+    }
+}

xnagui/Xna.Gui.Controls/RenderRules/BoardRenderRule.cs

     {
         private TextRenderer TextRenderer { get; set; }
         private SpriteFont Font { get { return TextRenderer.SpriteFont; } }
-        public Tile[,] Tiles { get; private set; }
+        public TileStack[,] TileStack { get; private set; }
 
         public BoardRenderRule(int boardWidth, int boardHeight)
         {
-            Tiles = new Tile[boardWidth, boardHeight];
+            TileStack = new TileStack[boardWidth, boardHeight];
         }
 
         private Rectangle _area;
         private const int Height = 20;
         public override void Draw(GameTime gameTime)
         {
-            for (var x = 0; x < Tiles.GetUpperBound(0); x++)
+            for (var x = 0; x < TileStack.GetUpperBound(0); x++)
             {
-                for (var y = 0; y < Tiles.GetUpperBound(1); y++)
+                for (var y = 0; y < TileStack.GetUpperBound(1); y++)
                 {
-                    if (Tiles[x, y] != null)
+                    if (TileStack[x, y] != null)
                     {
-                        foreach (var bitmapName in Tiles[x, y].BitmapNames)
+                        foreach (var bitmapName in TileStack[x, y].BitmapNames)
                         {
                             var position = new Rectangle(_area.Left + x * With, _area.Top + y * Height, With, Height);
                             TextRenderer.Render(RenderManager.SpriteBatch, bitmapName, position,

xnagui/Xna.Gui.Controls/Xna.Gui.Controls.csproj

   </ItemGroup>
   <ItemGroup>
     <Compile Include="Elements\Board.cs" />
+    <Compile Include="Elements\BoardItems\Fire.cs" />
     <Compile Include="Elements\BoardItems\Tile.cs" />
+    <Compile Include="Elements\BoardItems\TileStack.cs" />
     <Compile Include="Elements\Button.cs" />
     <Compile Include="Elements\CheckBox.cs" />
     <Compile Include="Elements\Image.cs" />

xnagui/Xna.Gui/Rendering/TextRenderer.cs

         }
 
         public void Render(SpriteBatch spriteBatch, string value, Rectangle renderArea,
-            TextHorizontal h = TextHorizontal.LeftAligned, TextVertical v = TextVertical.TopAligned) {
+            TextHorizontal h = TextHorizontal.LeftAligned, TextVertical v = TextVertical.TopAligned)
+        {
+            Render(spriteBatch, value, renderArea, Color, h, v);
+        }
+
+        public void Render(SpriteBatch spriteBatch, string value, Rectangle renderArea, Color color,
+            TextHorizontal h, TextVertical v) {
 
             var location = new Vector2(renderArea.X, renderArea.Y);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.