Beispiel #1
0
        public static void PostDraw(Texture2D Tex, Vector2 Position, Color Color, float Z, Texture2D Normal)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color   = Color;
            AddToPostQueue(DE, Z);
        }
Beispiel #2
0
        /// <summary>
        /// Drawing after main Draw
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Rectangle</param>
        public static void PostDraw(Texture2D Tex, Rectangle Position)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = Position;
            DE.Color   = Color.White;
            AddToPostQueue(DE, 0);
        }
Beispiel #3
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, Color Color, float Z, Texture2D Normal)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = Position;
            DE.Color   = Color;
            AddToPostQueue(DE, Z);
        }
Beispiel #4
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to Draw</param>
        /// <param name="Position">Position in Rectangle</param>
        public static void Draw(Texture2D Tex, Rectangle Position)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = Position;
            DE.Color = Color.White;
            AddToQueue(DE, 0);
        }
Beispiel #5
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Vector2</param>
        /// <param name="Color">Color to draw with</param>
        public static void Draw(Texture2D Tex, Vector2 Position, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color   = Color;
            AddToQueue(DE, 0);
        }
Beispiel #6
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Rectangle</param>
        /// <param name="Color">Color to draw with</param>
        public static void Draw(Texture2D Tex, Rectangle Position, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = Position;
            DE.Color   = Color;
            AddToQueue(DE, 0);
        }
Beispiel #7
0
        /// <summary>
        /// Drawing after main Draw
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Vector2</param>
        public static void PostDraw(Texture2D Tex, Vector2 Position)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color   = Color.White;

            AddToPostQueue(DE, 0);
        }
Beispiel #8
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Rectangle</param>
        /// <param name="color">Color to draw with</param>
        /// <param name="Angle">Angle to draw with</param>
        /// <param name="Center">Origin of texture</param>
        /// <param name="Z">Layer on wich to draw</param>
        public static void Draw(Texture2D Tex, Rectangle Position, Color color, float Angle, Vector2 Center, float Z)
        {
            DrawElement DE = new DrawElement();

            DE.Texture        = Tex;
            DE.Pos            = Position;
            DE.Color          = color;
            DE.Angle          = Angle;
            DE.RotationCenter = Center;
            AddToQueue(DE, Z);
        }
Beispiel #9
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture        = Tex;
            DE.Pos            = Position;
            DE.Color          = Color.White;
            DE.Angle          = Angle;
            DE.RotationCenter = Center;
            AddToPostQueue(DE, 0);
        }
Beispiel #10
0
        static Dictionary<string, RenderEffect> PostProcess;        /**< Post Processes */

        #region DrawFunctions

        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Vector2</param>
        public static void Draw(Texture2D Tex, Vector2 Position)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color.White;

            AddToQueue(DE, 0);

        }
Beispiel #11
0
        public static void PostDraw(Texture2D Tex, Vector2 Position, Color Color, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture        = Tex;
            DE.Pos            = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color          = Color;
            DE.Angle          = Angle;
            DE.RotationCenter = Center;

            AddToPostQueue(DE, 0);
        }
Beispiel #12
0
        public static void PostDrawFont(SpriteFont Font, Vector2 Position, string Text, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos     = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color   = Color;
            DE.Text    = Text;
            DE.Font    = Font;

            AddToPostQueue(DE, 0);
        }
Beispiel #13
0
        public static void PostDrawFont(SpriteFont Font, Rectangle Position, string Text, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos     = Position;
            DE.Color   = Color;
            DE.Text    = Text;
            DE.Font    = Font;

            AddToPostQueue(DE, 0);
        }
Beispiel #14
0
 static void AddToPostQueue(DrawElement DE, float Z)
 {
     if (PostDrawingQueue.ContainsKey(Z))
     {
         PostDrawingQueue[Z].Enqueue(DE);
     }
     else
     {
         Queue <DrawElement> DEList = new Queue <DrawElement>();
         DEList.Enqueue(DE);
         PostDrawingQueue.Add(Z, DEList);
     }
 }
Beispiel #15
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Vector2</param>
        /// <param name="Region">Region</param>
        /// <param name="Angle">Angle to drawi with</param>
        /// <param name="Center">Origin of texture</param>
        public static void Draw(Texture2D Tex, Vector2 Position, Rectangle Region, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture        = Tex;
            DE.Pos            = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color          = Color.White;
            DE.Region         = Region;
            DE.Angle          = Angle;
            DE.RotationCenter = Center;

            AddToQueue(DE, 0);
        }
Beispiel #16
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, bool Sciss, Rectangle?scissRect)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos     = Position;
            DE.Color   = Color.White;
            if (Sciss && scissRect.HasValue)
            {
                DE.Scissor = scissRect;
            }

            AddToPostQueue(DE, 0);
        }
Beispiel #17
0
        public static void PostDrawFont(SpriteFont Font, Vector2 Position, string Text, bool Sciss, Rectangle?scissRect)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos     = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color   = Color.White;
            DE.Text    = Text;
            DE.Font    = Font;

            if (Sciss && scissRect.HasValue)
            {
                DE.Scissor = scissRect;
            }

            AddToPostQueue(DE, 0);
        }
Beispiel #18
0
 static void SolveDraw(DrawElement DE)
 {
     if (DE.Region == null)
     {
         if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
         {
             if (DE.Font != null)
             {
                 //Jeżeli vector i tekst
                 SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X - Camera.GetRect.X, DE.Pos.Y - Camera.GetRect.Y), DE.Color);
             }
             else
             {
                 //jeżeli vector i tekstura
                 SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), null, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
             }
         }
         else
         {
             if (DE.Font != null)
             {
                 //jeżeli rectangle i text
                 float Scale         = (DE.Font.MeasureString(DE.Text).X) / (float)(DE.Pos.Width);
                 int   CurrentLenght = DE.Pos.X;
                 SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), DE.Color, 0f, Vector2.Zero, 1f / Scale, SpriteEffects.None, 0f);
             }
             else
             {
                 //jeżeli rectangle i tekstura
                 SpriteBatch.Draw(DE.Texture, Helper.SubRectPos(DE.Pos, Camera.GetRect), null, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
             }
         }
     }
     else if (DE.Font == null) // If there is region
     {
         if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
         {
             SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
         }
         else
         {
             SpriteBatch.Draw(DE.Texture, Helper.SubRectPos(DE.Pos, Camera.GetRect), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
         }
     }
 }
Beispiel #19
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, bool Sciss, Rectangle? scissRect)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = Position;
            DE.Color = Color.White;
            if (Sciss && scissRect.HasValue)
            {
                DE.Scissor = scissRect;
            }

            AddToPostQueue(DE, 0);
        }
Beispiel #20
0
        public static void PostDraw(Texture2D Tex, Vector2 Position, Color Color, float Z, Texture2D Normal)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color;
            AddToPostQueue(DE, Z);
        }
Beispiel #21
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, Color Color, float Z, Texture2D Normal)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = Position;
            DE.Color = Color;
            AddToPostQueue(DE, Z);
        }
Beispiel #22
0
        public static void PostDraw(Texture2D Tex, Vector2 Position, Rectangle Region, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color.White;
            DE.Region = Region;
            DE.Angle = Angle;
            DE.RotationCenter = Center;

            AddToPostQueue(DE, 0);

        }
Beispiel #23
0
        static void PostSolveDraw(DrawElement DE)
        {
            Rectangle currentRect = Rectangle.Empty;
            if (DE.Scissor.HasValue)
            {
                RasterizerState _rasterizerState = new RasterizerState() { ScissorTestEnable = true };

                SpriteBatch.End();

                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                      null, null, _rasterizerState);

                currentRect = SpriteBatch.GraphicsDevice.ScissorRectangle;

                SpriteBatch.GraphicsDevice.ScissorRectangle = DE.Scissor.Value;
            }

            if (DE.Region == null)
            {
                if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
                {
                    if (DE.Font != null)
                    {
                        //Jeżeli vector i tekst
                        SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y), DE.Color);
                    }
                    else
                    {
                        //jeżeli vector i tekstura
                        SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos), null, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
                    }
                }
                else
                {
                    if (DE.Font != null)
                    {
                        //jeżeli rectangle i text
                        float Scale = (DE.Font.MeasureString(DE.Text).X) / (float)(DE.Pos.Width);
                        int CurrentLenght = DE.Pos.X;
                        SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y), DE.Color, 0f, Vector2.Zero, 1f/Scale, SpriteEffects.None, 0f);
                    }
                    else
                    {
                        //jeżeli rectangle i tekstura
                        SpriteBatch.Draw(DE.Texture, DE.Pos, null, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
                    }
                }
            }
            else if (DE.Font == null) // If there is region 
            {
                if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
                {
                    SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
                }
                else
                {
                    SpriteBatch.Draw(DE.Texture, DE.Pos, DE.Region, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
                }
            }

            if (DE.Scissor.HasValue)
            {
                SpriteBatch.GraphicsDevice.ScissorRectangle = currentRect;
                SpriteBatch.End();
                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            }
        }
Beispiel #24
0
        public static void PostDrawFont(SpriteFont Font, Vector2 Position, string Text, bool Sciss, Rectangle? scissRect)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color.White;
            DE.Text = Text;
            DE.Font = Font;

            if (Sciss && scissRect.HasValue)
            {
                DE.Scissor = scissRect;
            }

            AddToPostQueue(DE, 0);
        }
Beispiel #25
0
        public static void PostDrawFont(SpriteFont Font, Vector2 Position, string Text, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color;
            DE.Text = Text;
            DE.Font = Font;

            AddToPostQueue(DE, 0);
        }
Beispiel #26
0
        public static void PostDrawFont(SpriteFont Font, Rectangle Position, string Text, Color Color)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = null;
            DE.Pos = Position;
            DE.Color = Color;
            DE.Text = Text;
            DE.Font = Font;

            AddToPostQueue(DE, 0);
        }
Beispiel #27
0
 static void SolveDraw(DrawElement DE)
 {
     if (DE.Region == null)
     {
         if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
         {
             if (DE.Font != null)
             {
                 //Jeżeli vector i tekst
                 SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X - Camera.GetRect.X, DE.Pos.Y - Camera.GetRect.Y), DE.Color);
             }
             else
             {
                 //jeżeli vector i tekstura
                 SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), null, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
             }
         }
         else
         {
             if (DE.Font != null)
             {
                 //jeżeli rectangle i text
                 float Scale = (DE.Font.MeasureString(DE.Text).X) / (float)(DE.Pos.Width);
                 int CurrentLenght = DE.Pos.X;
                 SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), DE.Color, 0f, Vector2.Zero, 1f/Scale, SpriteEffects.None, 0f);
             }
             else
             {
                 //jeżeli rectangle i tekstura
                 SpriteBatch.Draw(DE.Texture, Helper.SubRectPos(DE.Pos, Camera.GetRect), null, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
             }
         }
     }
     else if(DE.Font == null) // If there is region 
     {
         if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
         {
             SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos) - new Vector2(Camera.GetRect.X, Camera.GetRect.Y), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
         }
         else
         {
             SpriteBatch.Draw(DE.Texture, Helper.SubRectPos(DE.Pos, Camera.GetRect), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
         }
     }
 }
Beispiel #28
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Vector2</param>
        /// <param name="Color">Color to draw with</param>
        /// <param name="Angle">Angle to draw with</param>
        /// <param name="Center">Origin of texture</param>
        public static void Draw(Texture2D Tex, Vector2 Position, Color Color, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = new Rectangle((int)Position.X, (int)Position.Y, 0, 0);
            DE.Color = Color;
            DE.Angle = Angle;
            DE.RotationCenter = Center;

            AddToQueue(DE, 0);
        }
Beispiel #29
0
        static void PostSolveDraw(DrawElement DE)
        {
            Rectangle currentRect = Rectangle.Empty;

            if (DE.Scissor.HasValue)
            {
                RasterizerState _rasterizerState = new RasterizerState()
                {
                    ScissorTestEnable = true
                };

                SpriteBatch.End();

                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                                  null, null, _rasterizerState);

                currentRect = SpriteBatch.GraphicsDevice.ScissorRectangle;

                SpriteBatch.GraphicsDevice.ScissorRectangle = DE.Scissor.Value;
            }

            if (DE.Region == null)
            {
                if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
                {
                    if (DE.Font != null)
                    {
                        //Jeżeli vector i tekst
                        SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y), DE.Color);
                    }
                    else
                    {
                        //jeżeli vector i tekstura
                        SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos), null, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
                    }
                }
                else
                {
                    if (DE.Font != null)
                    {
                        //jeżeli rectangle i text
                        float Scale         = (DE.Font.MeasureString(DE.Text).X) / (float)(DE.Pos.Width);
                        int   CurrentLenght = DE.Pos.X;
                        SpriteBatch.DrawString(DE.Font, DE.Text, new Vector2(DE.Pos.X, DE.Pos.Y), DE.Color, 0f, Vector2.Zero, 1f / Scale, SpriteEffects.None, 0f);
                    }
                    else
                    {
                        //jeżeli rectangle i tekstura
                        SpriteBatch.Draw(DE.Texture, DE.Pos, null, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
                    }
                }
            }
            else if (DE.Font == null) // If there is region
            {
                if (DE.Pos.Width == 0 && DE.Pos.Height == 0)
                {
                    SpriteBatch.Draw(DE.Texture, Helper.GetTopLeftFromRect(DE.Pos), DE.Region, DE.Color, DE.Angle, DE.RotationCenter, Vector2.One, SpriteEffects.None, 0f);
                }
                else
                {
                    SpriteBatch.Draw(DE.Texture, DE.Pos, DE.Region, DE.Color, DE.Angle, DE.RotationCenter, SpriteEffects.None, 0f);
                }
            }

            if (DE.Scissor.HasValue)
            {
                SpriteBatch.GraphicsDevice.ScissorRectangle = currentRect;
                SpriteBatch.End();
                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            }
        }
Beispiel #30
0
        public static void PostDraw(Texture2D Tex, Rectangle Position, Color Color, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = Position;
            DE.Color = Color;
            DE.Angle = Angle;
            DE.RotationCenter = Center;

            AddToPostQueue(DE, 0);
        }
Beispiel #31
0
        /// <summary>
        /// Draw Function
        /// </summary>
        /// <param name="Tex">Texture to draw</param>
        /// <param name="Position">Position in Rectangle</param>
        /// <param name="Region">Region</param>
        /// <param name="Angle">Angle to draw with</param>
        /// <param name="Center">Origin of texture</param>
        public static void Draw(Texture2D Tex, Rectangle Position, Rectangle Region, float Angle, Vector2 Center)
        {
            DrawElement DE = new DrawElement();

            DE.Texture = Tex;
            DE.Pos = Position;
            DE.Color = Color.White;
            DE.Region = Region;
            DE.Angle = Angle;
            DE.RotationCenter = Center;

            AddToQueue(DE, 0);
        }
Beispiel #32
0
 static void AddToPostQueue(DrawElement DE, float Z)
 {
     if (PostDrawingQueue.ContainsKey(Z))
     {
         PostDrawingQueue[Z].Enqueue(DE);
     }
     else
     {
         Queue<DrawElement> DEList = new Queue<DrawElement>();
         DEList.Enqueue(DE);
         PostDrawingQueue.Add(Z, DEList);
     }
 }