Пример #1
0
 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
0
 public void Draw(Canvas canvas)
 {
     canvas.PushCamera(absoluteCamera);
     DrawSelector(canvas);
     canvas.PopCamera();
 }
Пример #3
0
 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();
 }