SadConsole.Cell.Render C# (CSharp) Method

Render() public method

Draws a single cell using the specified SpriteBatch.
public Render ( SpriteBatch batch, Point position, Point size, Font font ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch Rendering batch.
position Microsoft.Xna.Framework.Point Pixel position on the screen to render.
size Microsoft.Xna.Framework.Point Rendering size of the cell.
font Font Font used to draw the cell.
return void
        public void Render(SpriteBatch batch, Point position, Point size, Font font)
        {
            Render(batch, new Rectangle(position.X, position.Y, size.X, size.Y), font);
        }

Same methods

Cell::Render ( SpriteBatch batch, Rectangle drawingRectangle, Font font ) : void

Usage Example

示例#1
0
        public void Render()
        {
            if (HotspotPanel.DrawHotspots && Hotspots.Count != 0)
            {
                SpriteBatch batch = new SpriteBatch(Engine.Device);
                batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.DepthRead, RasterizerState.CullNone);

                foreach (var spot in Hotspots)
                {
                    Cell cell = new Cell();
                    spot.DebugAppearance.CopyAppearanceTo(cell);
                    Point offset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location;
                    foreach (var position in spot.Positions)
                    {
                        Point adjustedPosition = position + offset;
                        if (consoleWrapper.TextSurface.RenderArea.Contains(position))
                            cell.Render(batch,
                                        new Rectangle(adjustedPosition.ConsoleLocationToWorld(Settings.Config.ScreenFont.Size.X, Settings.Config.ScreenFont.Size.Y), Settings.Config.ScreenFont.Size),
                                        Settings.Config.ScreenFont);

                    }

                }

                batch.End();
            }
            if (ZonesPanel.DrawZones)
                foreach (var zone in Zones)
                {
                    zone.Render();
                }

            if (GameObjectPanel.DrawObjects)
                foreach (var entity in Objects)
                {
                    entity.Render();
                }
        }