當前位置: 首頁>>代碼示例>>C#>>正文


C# Canvas.PopCamera方法代碼示例

本文整理匯總了C#中Canvas.PopCamera方法的典型用法代碼示例。如果您正苦於以下問題:C# Canvas.PopCamera方法的具體用法?C# Canvas.PopCamera怎麽用?C# Canvas.PopCamera使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Canvas的用法示例。


在下文中一共展示了Canvas.PopCamera方法的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.PopCamera方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。