本文整理汇总了C#中Canvas.DrawTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawTexture方法的具体用法?C# Canvas.DrawTexture怎么用?C# Canvas.DrawTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.DrawTexture方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Canvas canvas)
{
canvas.PushCamera(absoluteCamera);
int x = -2 * texture.Width;
while (x < canvas.ActiveCamera.Width / GraphicsConstants.GRAPHICS_SCALE)
{
int y = -2 * texture.Height;
while (y < canvas.ActiveCamera.Height / GraphicsConstants.GRAPHICS_SCALE)
{
canvas.DrawTexture(texture, backgroundColor, GraphicsConstants.GRAPHICS_SCALE * (new Vector2(x, y) + offset), 0f, 1f);
canvas.DrawTexture(texture, backgroundColor, GraphicsConstants.GRAPHICS_SCALE * (new Vector2(x + texture.Width, y + texture.Height) + offset), 0f, 1f);
y += 2 * texture.Height;
}
x += 2 * texture.Width;
}
canvas.PopCamera();
}
示例2: Draw
public void Draw(Canvas canvas)
{
for (int i = 0; i < particles.Length; i++)
canvas.DrawTexture(texture, particles[i].Color, particles[i].Position, particles[i].Rotation, particles[i].Scale);
}
示例3: Draw
public override void Draw(Canvas canvas, Vector2 selectorPosition)
{
canvas.DrawTexture(graphic, color, currentPosition + selectorPosition, anchor, 0, 0.5f);
}
示例4: Draw
public void Draw(GameTime gameTime, Canvas canvas)
{
canvas.PushCamera(camera);
if (particleLayer == -1)
particles.Draw(canvas);
Vector2 offset = (camera.ActualPosition - seamstressStart) / 2;
offset.Y = 0;
for (int i = 0; i < backgrounds.Length; i++)
{
Vector2 position = backgrounds[i].InitialOffset * camera.Dimensions - offset / backgrounds[i].Distance + backgrounds[i].Velocity * (float)gameTime.TotalGameTime.TotalSeconds;
Vector2 increment = new Vector2(backgrounds[i].Texture.Width / GraphicsConstants.PIXELS_PER_UNIT, backgrounds[i].Texture.Height / GraphicsConstants.PIXELS_PER_UNIT);
if (backgrounds[i].RepeatX)
{
while (position.X < -increment.X)
position.X += increment.X;
while (position.X > 0)
position.X -= increment.X;
}
if (backgrounds[i].RepeatY)
{
while (position.Y < -increment.Y)
position.Y += increment.Y;
while (backgrounds[i].RepeatY && position.Y > 0)
position.Y -= increment.Y;
}
while (position.X <= camera.Dimensions.X)
{
float cachedY = position.Y;
while (position.Y <= camera.Dimensions.Y)
{
canvas.DrawTexture(backgrounds[i].Texture, Color.White, position * GraphicsConstants.GRAPHICS_SCALE, Anchor.TopLeft);
if (backgrounds[i].RepeatY)
position.Y += increment.Y;
else break;
}
position.Y = cachedY;
if (backgrounds[i].RepeatX)
position.X += increment.X;
else break;
}
if (particleLayer == i)
particles.Draw(canvas);
}
canvas.PopCamera();
}
示例5: Draw
public override void Draw(Canvas canvas, Vector2 selectorPosition)
{
canvas.DrawTexture(texture, textureColor, position + selectorPosition, Anchor.TopLeft, 0f, 0.5f);
}