public void Draw(Renderer.RendererBase render, Rectangle r, Color col)
        {
            if (m_Texture == null)
            {
                return;
            }

            render.DrawColor = col;

            if (r.Width < m_Width && r.Height < m_Height)
            {
                render.DrawTexturedRect(m_Texture, r, m_Rects[0].uv[0], m_Rects[0].uv[1], m_Rects[8].uv[2], m_Rects[8].uv[3]);
                return;
            }

            DrawRect(render, 0, r.X, r.Y, m_Margin.Left, m_Margin.Top);
            DrawRect(render, 1, r.X + m_Margin.Left, r.Y, r.Width - m_Margin.Left - m_Margin.Right, m_Margin.Top);
            DrawRect(render, 2, (r.X + r.Width) - m_Margin.Right, r.Y, m_Margin.Right, m_Margin.Top);

            DrawRect(render, 3, r.X, r.Y + m_Margin.Top, m_Margin.Left, r.Height - m_Margin.Top - m_Margin.Bottom);
            DrawRect(render, 4, r.X + m_Margin.Left, r.Y + m_Margin.Top, r.Width - m_Margin.Left - m_Margin.Right,
                     r.Height - m_Margin.Top - m_Margin.Bottom);
            DrawRect(render, 5, (r.X + r.Width) - m_Margin.Right, r.Y + m_Margin.Top, m_Margin.Right,
                     r.Height - m_Margin.Top - m_Margin.Bottom);

            DrawRect(render, 6, r.X, (r.Y + r.Height) - m_Margin.Bottom, m_Margin.Left, m_Margin.Bottom);
            DrawRect(render, 7, r.X + m_Margin.Left, (r.Y + r.Height) - m_Margin.Bottom,
                     r.Width - m_Margin.Left - m_Margin.Right, m_Margin.Bottom);
            DrawRect(render, 8, (r.X + r.Width) - m_Margin.Right, (r.Y + r.Height) - m_Margin.Bottom, m_Margin.Right,
                     m_Margin.Bottom);
        }
Beispiel #2
0
 private void DrawRect(Renderer.RendererBase render, int i, int x, int y, int w, int h)
 {
     if (w > 0 && h > 0)
     {
         render.DrawTexturedRect(m_Texture,
                                 new Rectangle(x, y, w, h),
                                 m_Rects[i].uv[0], m_Rects[i].uv[1], m_Rects[i].uv[2], m_Rects[i].uv[3]);
     }
 }
Beispiel #3
0
        public void Draw(Renderer.RendererBase render, Rectangle r, Color col)
        {
            if (m_Texture == null)
            {
                return;
            }

            render.DrawColor = col;
            render.DrawTexturedRect(m_Texture, r, m_uv[0], m_uv[1], m_uv[2], m_uv[3]);
        }
Beispiel #4
0
 private void drawRect(Renderer.RendererBase render, int i, int x, int y, int w, int h)
 {
     render.DrawTexturedRect(texture,
                             new Rectangle(x, y, w, h),
                             rects[i].uv[0], rects[i].uv[1], rects[i].uv[2], rects[i].uv[3]);
 }