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); }
/// <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); }
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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
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); }
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); }
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); }
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); }
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); }
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); } }
/// <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); }
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); }
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); }
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); } } }
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); }
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); }
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); } }
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); }
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); } } }
/// <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); }
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); } }
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); }
/// <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); }
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); } }