Commits

Bożydar Sobczak committed a33bd5c

Refactor: gameTime added to all draw methods.

Comments (0)

Files changed (14)

FunctionalRogue.View/Interfaces.fs

     default this.Update () =
         this.Gui.Update()
 
-    abstract member Draw : unit -> unit
-    default this.Draw() =
-        this.Gui.Draw()
+    abstract member Draw : GameTime -> unit
+    default this.Draw(gameTime) =
+        this.Gui.Draw(gameTime)
 
     member this.RegisterKeyEvent key event =
         this.Gui.KeyDown.AddHandler(

functional-rogue-xna/functional-rogue-xna/Game1.cs

 
             if (_screen != null)
             {
-                _screen.Draw();
+                _screen.Draw(gameTime);
             }
             base.Draw(gameTime);
         }

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

 
         private const int With = 20;
         private const int Height = 20;
-        public override void Draw()
+        public override void Draw(GameTime gameTime)
         {
             for (var x = 0; x < Tiles.GetUpperBound(0); x++)
             {

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

             _textRenderer = RenderManager.TextRenderers[RenderManager.DefaultTextRenderer];
         }
 
-        public override void Draw() {
+        public override void Draw(GameTime gameTime) {
 
             switch (Mode) {
                 case RenderMode.Default: {

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

             _hoverChecked = LoadRenderer<IconRenderer>(Skin, _type + "_hover_checked");            
         }
 
-        public override void Draw() {
+        public override void Draw(GameTime gameTime) {
 
             if (Checked) {
                 if (Hover) {

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

         {
         }
 
-        public override void Draw() {            
+        public override void Draw(GameTime gameTime) {            
 
             if (Label != null) {                
                 TextRenderer.Render(RenderManager.SpriteBatch, Label, _area,

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

             _default = LoadRenderer<BorderRenderer>(Skin, "panel");
         }
 
-        public override void Draw()
+        public override void Draw(GameTime gameTime)
         {
             _default.Render(RenderManager.SpriteBatch, Area);
         }

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

             RenderManager = manager;
         }
 
-        public override void Draw() {
+        public override void Draw(GameTime gameTime) {
             
             Holder.Render(RenderManager.SpriteBatch, HolderArea);
             Bar.Render(RenderManager.SpriteBatch, BarArea);

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

             Vertical.Load();
         }
 
-        public override void Draw() {
+        public override void Draw(GameTime gameTime) {
 
             if (BarDirection == Direction.Horizontal || BarDirection == Direction.Both) {
-                Horizontal.Draw();
+                Horizontal.Draw(gameTime);
             }
             if (BarDirection == Direction.Vertical || BarDirection == Direction.Both) {
-                Vertical.Draw();
+                Vertical.Draw(gameTime);
             }            
         }
     }

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

             SetText(String.Empty);
         }
 
-        public override void Draw() {
+        public override void Draw(GameTime gameTime) {
             if (RenderedText != null) { RenderManager.SpriteBatch.Draw(RenderedText, Area, Color.White); }
             if (CursorVisible) { RenderCursor(RenderManager.SpriteBatch, Area); }
             RenderSelection(Area);

xnagui/Xna.Gui/Gui.cs

             });
         }
 
-        public void Draw() {
+        public void Draw(GameTime gameTime) {
           
-            RenderManager.Draw(Dom);            
+            RenderManager.Draw(Dom, gameTime);            
         }
     }
 }

xnagui/Xna.Gui/Layout/RenderRule.cs

             Loaded = true;
         }        
 
-        public abstract void Draw();
+        public abstract void Draw(GameTime gameTime);
     }
 }

xnagui/Xna.Gui/Rendering/RenderManager.cs

         /*                         State Management                           */
         /*####################################################################*/
 
-        internal void Draw(Root<Widget> dom) {
+        internal void Draw(Root<Widget> dom, GameTime gameTime) {
 
             SpriteBatch.Begin(
                 SpriteSortMode.Immediate,
             dom.DfsOperationChildren(node => {
                 if (!node.Data.Visible) return;
                 GraphicsDevice.ScissorRectangle = node.Data.SissorArea;
-                node.Data.Draw();
+                node.Data.Draw(gameTime);
             });
 
             SpriteBatch.End();

xnagui/Xna.Gui/Widget.cs

             AbsoluteArea = Area;
         }        
 
-        internal override void Draw() { RenderRule.Draw(); }
+        internal override void Draw(GameTime gameTime) { RenderRule.Draw(gameTime); }
     }
 
     public abstract class Widget : ITreeNode<Widget> {
         public abstract void Layout();
 
         internal protected abstract void Update();
-        internal abstract void Draw();
+        internal abstract void Draw(GameTime gameTime);
 
         #endregion
     }