Пример #1
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     spriteBatch.Draw(_texture[ImageIndex],
         position: Position - camera.Position,
         rotation: Rotation,
         origin: Origin);
 }
Пример #2
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     int offset = (int)(_paralax * camera.Position.X);
     int top = camera.Bounds.Bottom - _texture.Height;
     int firstSegment = offset / _texture.Width;
     int lastSegment = firstSegment + camera.Bounds.Width / _texture.Width + 2;
     for (int segmentIndex = firstSegment; segmentIndex < lastSegment; segmentIndex++)
     {
         int x =
             camera.Bounds.Left - offset +
             segmentIndex * _texture.Width;
         spriteBatch.Draw(_texture,
             position: new Vector2(x, top));
     }
 }
Пример #3
0
        public void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            int gapEnd = _gapStart + GapSize;

            int segmentCount = GetSegmentCount(camera.Bounds);
            for (int segmentIndex = 0; segmentIndex < _gapStart; ++segmentIndex)
            {
                DrawSegment(spriteBatch, camera, segmentIndex, _resources.Segment);
            }
            DrawSegment(spriteBatch, camera, _gapStart, _resources.CapBottom);
            DrawSegment(spriteBatch, camera, gapEnd, _resources.CapTop);
            for (int segmentIndex = gapEnd + 1; segmentIndex < segmentCount; ++segmentIndex)
            {
                DrawSegment(spriteBatch, camera, segmentIndex, _resources.Segment);
            }
        }
Пример #4
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     _sprite.Draw(spriteBatch, camera);
 }
Пример #5
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     foreach (var pipe in _pipes)
         pipe.Draw(spriteBatch, camera);
 }
Пример #6
0
        private void DrawSegment(
            SpriteBatch spriteBatch,
            Camera camera,
            int segmentIndex,
            Texture2D image)
        {
            Vector2 position = new Vector2(_location,
                SegmentVerticalCenter + segmentIndex * SegmentHeight);

            spriteBatch.Draw(image,
                position: position - camera.Position,
                origin: Origin);
        }
Пример #7
0
 public Viewer()
 {
     _camera = new Camera();
     _cameraBody = new Body();
     _cameraBody.ChangeVelocity(new GameTime(), new Vector2(300.0f, 0.0f));
 }