Cascade.PanelManager.Draw C# (CSharp) Method

Draw() public method

public Draw ( GraphicsDevice GraphicsDevice, GraphicsDeviceManager graphics, SpriteBatch spriteBatch, RenderTarget2D defaultRenderTarget, int width, int height ) : void
GraphicsDevice GraphicsDevice
graphics GraphicsDeviceManager
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
defaultRenderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D
width int
height int
return void
        public void Draw(GraphicsDevice GraphicsDevice, GraphicsDeviceManager graphics, SpriteBatch spriteBatch, RenderTarget2D defaultRenderTarget, int width, int height)
        {
            int w = width; int h = height;
            float add = 0.5f;

            float panelWidth = ((w - add) / (float)panels.Count) - (add);

            float x = 0;
            for (int i = 0; i < panels.Count; i++)
            {
                x += add;
                var r = new PolygonRect(panelWidth, h);
                for (int o = 0; o < r.vertices.Length; o++)
                {
                    r.vertices[o].Position.X += x;
                    r.vertices[o].Color = panels[i].Color;
                }
                x += panelWidth;
                GraphicsDevice.DrawUserPrimitives<CascadeVertex>(PrimitiveType.TriangleList, r.vertices, 0, 2);
            }
        }
    }