/// <summary>
        /// Renders the cells of a control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="renderer">The renderer used with this step.</param>
        /// <param name="font">The font to render the cells with.</param>
        /// <param name="fontSize">The size of a cell in pixels.</param>
        /// <param name="parentViewRect">The view of the parent to cull cells from.</param>
        /// <param name="bufferWidth">The width of the parent used to calculate the render rect.</param>
        protected void RenderControlCells(SadConsole.UI.Controls.ControlBase control, ScreenSurfaceRenderer renderer, IFont font, SadRogue.Primitives.Point fontSize, SadRectangle parentViewRect, int bufferWidth)
        {
            font = control.AlternateFont ?? font;

            var          fontImage = ((SadConsole.Host.GameTexture)font.Image).Texture;
            ColoredGlyph cell;

            for (int y = 0; y < control.Surface.View.Height; y++)
            {
                int i = ((y + control.Surface.ViewPosition.Y) * control.Surface.Width) + control.Surface.ViewPosition.X;

                for (int x = 0; x < control.Surface.View.Width; x++)
                {
                    cell         = control.Surface[i];
                    cell.IsDirty = false;

                    if (cell.IsVisible)
                    {
                        SadRogue.Primitives.Point cellRenderPosition = control.AbsolutePosition + (x, y);

                        if (!parentViewRect.Contains(cellRenderPosition))
                        {
                            continue;
                        }

                        XnaRectangle renderRect = renderer.CachedRenderRects[(cellRenderPosition - parentViewRect.Position).ToIndex(bufferWidth)];

                        if (cell.Background != SadRogue.Primitives.Color.Transparent)
                        {
                            Host.Global.SharedSpriteBatch.Draw(fontImage, renderRect, font.SolidGlyphRectangle.ToMonoRectangle(), cell.Background.ToMonoColor(), 0f, Vector2.Zero, SpriteEffects.None, 0.3f);
                        }

                        if (cell.Foreground != SadRogue.Primitives.Color.Transparent)
                        {
                            Host.Global.SharedSpriteBatch.Draw(fontImage, renderRect, font.GetGlyphSourceRectangle(cell.Glyph).ToMonoRectangle(), cell.Foreground.ToMonoColor(), 0f, Vector2.Zero, cell.Mirror.ToMonoGame(), 0.4f);
                        }

                        foreach (CellDecorator decorator in cell.Decorators)
                        {
                            if (decorator.Color != SadRogue.Primitives.Color.Transparent)
                            {
                                Host.Global.SharedSpriteBatch.Draw(fontImage, renderRect, font.GetGlyphSourceRectangle(decorator.Glyph).ToMonoRectangle(), decorator.Color.ToMonoColor(), 0f, Vector2.Zero, decorator.Mirror.ToMonoGame(), 0.5f);
                            }
                        }
                    }

                    i++;
                }
            }
        }
        /// <summary>
        /// Renders the cells of a control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="renderer">The renderer used with this step.</param>
        /// <param name="font">The font to render the cells with.</param>
        /// <param name="fontSize">The size of a cell in pixels.</param>
        /// <param name="parentViewRect">The view of the parent to cull cells from.</param>
        /// <param name="bufferWidth">The width of the parent used to calculate the render rect.</param>
        protected void RenderControlCells(UI.Controls.ControlBase control, ScreenSurfaceRenderer renderer, IFont font, Point fontSize, Rectangle parentViewRect, int bufferWidth)
        {
            font = control.AlternateFont ?? font;
            ColoredGlyph cell;

            //if (control.Surface.DefaultBackground.A != 0)
            //{
            //    (int x, int y) = (control.AbsolutePosition - parentViewRect.Position).SurfaceLocationToPixel(fontSize);
            //    (int width, int height) = new Point(control.Surface.View.Width, control.Surface.View.Height) * fontSize;

            //    Host.Global.SharedSpriteBatch.DrawQuad(new IntRect(x, y, x + width, y + height), font.SolidGlyphRectangle.ToIntRect(), control.Surface.DefaultBackground.ToSFMLColor(), ((SadConsole.Host.GameTexture)font.Image).Texture);
            //}
            for (int y = 0; y < control.Surface.View.Height; y++)
            {
                int i = ((y + control.Surface.ViewPosition.Y) * control.Surface.Width) + control.Surface.ViewPosition.X;

                for (int x = 0; x < control.Surface.View.Width; x++)
                {
                    cell         = control.Surface[i];
                    cell.IsDirty = false;

                    if (cell.IsVisible)
                    {
                        SadRogue.Primitives.Point cellRenderPosition = control.AbsolutePosition + (x, y);

                        if (!parentViewRect.Contains(cellRenderPosition))
                        {
                            continue;
                        }

                        IntRect renderRect = renderer.CachedRenderRects[(cellRenderPosition - parentViewRect.Position).ToIndex(bufferWidth)];

                        Host.Global.SharedSpriteBatch.DrawCell(cell, renderRect, true, font);
                    }

                    i++;
                }
            }
        }
예제 #3
0
 public static bool Equals(this SadRoguePoint self, Vector2u other) => self.X == other.X && self.Y == other.Y;
예제 #4
0
 public static SadRoguePoint Subtract(this SadRoguePoint self, Vector2u other)
 => new SadRoguePoint(self.X - (int)other.X, self.Y - (int)other.Y);
예제 #5
0
 public static bool Matches(this Vector2f self, SadRoguePoint other)
 => Math.Abs(self.X - other.X) < 0.0000000001 && Math.Abs(self.Y - other.Y) < 0.0000000001;
예제 #6
0
 public static Vector2f Multiply(this Vector2f self, SadRoguePoint other)
 => new Vector2f(self.X * other.X, self.Y * other.Y);
예제 #7
0
 public static Vector2f Subtract(this Vector2f self, SadRoguePoint other)
 => new Vector2f(self.X - other.X, self.Y - other.Y);
예제 #8
0
 public static bool Matches(this Vector2u self, SadRoguePoint other) => self.X == other.X && self.Y == other.Y;
예제 #9
0
 public static Vector2u Multiply(this Vector2u self, SadRoguePoint other)
 => new Vector2u((uint)(self.X * other.X), (uint)(self.Y * other.Y));
 public static SadRoguePoint Multiply(this SadRoguePoint self, MonoPoint other)
 => new SadRoguePoint(self.X * other.X, self.Y * other.Y);
 public static SadRoguePoint Subtract(this SadRoguePoint self, MonoPoint other)
 => new SadRoguePoint(self.X - other.X, self.Y - other.Y);
 public static MonoPoint ToMonoPoint(this SadRoguePoint self) => new MonoPoint(self.X, self.Y);
 public static MonoPoint Divide(this MonoPoint self, SadRoguePoint other)
 => new MonoPoint((int)Math.Round(self.X / (double)other.X, MidpointRounding.AwayFromZero),
                  (int)Math.Round(self.Y / (double)other.Y, MidpointRounding.AwayFromZero));
예제 #14
0
 public static bool Equals(this Vector2i self, SadRoguePoint other) => self.X == other.X && self.Y == other.Y;
예제 #15
0
 public static bool Equals(this SadRoguePoint self, Vector2f other)
 => Math.Abs(self.X - other.X) < 0.0000000001 && Math.Abs(self.Y - other.Y) < 0.0000000001;
예제 #16
0
 public static Vector2f ToVector2f(this SadRoguePoint self) => new Vector2f(self.X, self.Y);
예제 #17
0
 public static Vector2u Subtract(this Vector2u self, SadRoguePoint other)
 => new Vector2u((uint)(self.X - other.X), (uint)(self.Y - other.Y));
 public static bool Equals(this SadRoguePoint self, MonoPoint other) => self.X == other.X && self.Y == other.Y;
예제 #19
0
 public static Vector2u Divide(this Vector2u self, SadRoguePoint other)
 => new Vector2u((uint)Math.Round(self.X / (double)other.X, MidpointRounding.AwayFromZero),
                 (uint)Math.Round(self.Y / (double)other.Y, MidpointRounding.AwayFromZero));
 public static MonoPoint Add(this MonoPoint self, SadRoguePoint other)
 => new MonoPoint(self.X + other.X, self.Y + other.Y);
예제 #21
0
 public static Vector2f Add(this Vector2f self, SadRoguePoint other)
 => new Vector2f(self.X + other.X, self.Y + other.Y);
예제 #22
0
 public static SadRoguePoint Multiply(this SadRoguePoint self, Vector2u other)
 => new SadRoguePoint(self.X * (int)other.X, self.Y * (int)other.Y);
예제 #23
0
 public static SadRoguePoint Add(this SadRoguePoint self, Vector2u other)
 => new SadRoguePoint(self.X + (int)other.X, self.Y + (int)other.Y);
예제 #24
0
 public static SadRoguePoint Divide(this SadRoguePoint self, Vector2u other)
 => new SadRoguePoint((int)Math.Round(self.X / (double)other.X, MidpointRounding.AwayFromZero),
                      (int)Math.Round(self.Y / (double)other.Y, MidpointRounding.AwayFromZero));
예제 #25
0
 public static Vector2f Divide(this Vector2f self, SadRoguePoint other)
 => new Vector2f(self.X / other.X, self.Y / other.Y);
예제 #26
0
 public static bool Matches(this SadRoguePoint self, Vector2i other) => self.X == other.X && self.Y == other.Y;
예제 #27
0
 public static SadRoguePoint Add(this SadRoguePoint self, Vector2f other)
 => new SadRoguePoint((int)Math.Round(self.X + other.X, MidpointRounding.AwayFromZero),
                      (int)Math.Round(self.Y + other.Y, MidpointRounding.AwayFromZero));
예제 #28
0
 public static Vector2u ToVector2u(this SadRoguePoint self) => new Vector2u((uint)self.X, (uint)self.Y);
예제 #29
0
 public static Vector2u Add(this Vector2u self, SadRoguePoint other)
 => new Vector2u(self.X + (uint)other.X, self.Y + (uint)other.Y);
예제 #30
0
 public static bool Matches(this MonoPoint self, SadRoguePoint other) => self.X == other.X && self.Y == other.Y;