本文整理汇总了C#中Renderer.DrawTexturedRect方法的典型用法代码示例。如果您正苦于以下问题:C# Renderer.DrawTexturedRect方法的具体用法?C# Renderer.DrawTexturedRect怎么用?C# Renderer.DrawTexturedRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderer
的用法示例。
在下文中一共展示了Renderer.DrawTexturedRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Renderer.Base 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);
}
示例2: Draw
public void Draw(Renderer.Base 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]);
}
示例3: DrawRect
void DrawRect(Renderer.Base render, int i, int x, int y, int w, int h)
{
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]);
}
示例4: Draw
public void Draw(Renderer.RendererBase render, Rectangle r, Color col)
{
if (m_Texture == null)
return;
render.DrawColor = col;
int minWidth = m_Margin.Left + m_Margin.Right;
int minHeight = m_Margin.Top + m_Margin.Bottom;
if (r.Width < minWidth || r.Height < minHeight)
{
// Just draw the full rect if the width or height is insufficient to draw the borders
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);
}