当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.PushCamera方法代码示例

本文整理汇总了C#中Canvas.PushCamera方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.PushCamera方法的具体用法?C# Canvas.PushCamera怎么用?C# Canvas.PushCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canvas的用法示例。


在下文中一共展示了Canvas.PushCamera方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
 }
开发者ID:kjin,项目名称:TubeRacer,代码行数:17,代码来源:ScrollingLogoBackground.cs

示例2: Draw

 public void Draw(Canvas canvas)
 {
     canvas.PushCamera(absoluteCamera);
     DrawSelector(canvas);
     canvas.PopCamera();
 }
开发者ID:kjin,项目名称:TubeRacer,代码行数:6,代码来源:Selector.cs

示例3: 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();
 }
开发者ID:kjin,项目名称:TubeRacer,代码行数:45,代码来源:ParallaxBackground.cs


注:本文中的Canvas.PushCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。