示例#1
0
        public void Draw(IGraphicsAdapter pSystem, float pDeltaTime)
        {
            if (Bitmap != null)
            {
                var t = Transform.Create(GameObject);
                pSystem.SetTransform(t);

                var position = GameObject.Position;
                if (_body != null)
                {
                    position += _body.Velocity * pDeltaTime * GameTime.DeltaTime;               //Interpolate position based on the amount of leftover update time
                }
                position = Game.ActiveCamera.ToCameraSpace(position);

                var scale = GameObject.Scale * Game.ActiveCamera.Zoom;

                if (Effect != null)
                {
                    Effect.Draw(Bitmap, Opacity, position, scale);
                }
                else
                {
                    pSystem.DrawBitmap(Bitmap, Opacity, position, scale);
                }
            }
        }
示例#2
0
 protected override void DoDraw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawBitmap(Bitmap,
                        Opacity,
                        GameObject.ScreenPosition,
                        GameObject.Scale * Game.ActiveCamera.Zoom,
                        new Rectangle(_currentFrame * _frameSize.X, AnimationNum * _frameSize.Y, _frameSize.X, _frameSize.Y));
 }
示例#3
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            _terrain.BitmapData(ref _image, _resolution);

            pSystem.DrawBitmap(_image, 1, Position, new Vector2(Width, Height));
            var x = Game.ActiveCamera.Position * _ratio;
            var w = Game.ActiveCamera.Width * _ratio;
            var h = Game.ActiveCamera.Height * _ratio;

            pSystem.DrawRect(new Rectangle(Position.X + x.X, Position.Y + x.Y, w, h), _cameraOutline, 1);
            pSystem.DrawRect(new Rectangle(Position, Width, Height), _cameraOutline, 2);
        }
示例#4
0
        protected override void DoDraw(IGraphicsAdapter pSystem)
        {
            //TODO make a custom component that handles rendering this?
            var scale = new Vector2(GameObject.Scale.X / 2, GameObject.Scale.Y / 2) * Game.ActiveCamera.Zoom;
            var pos   = GameObject.ScreenPosition + new Vector2(scale.X / 2, -scale.Y / 2);

            if (_currentStatus.HasFlag(Status.Scared))
            {
                pSystem.DrawBitmap(_scared, 1, pos, scale);
            }
            else if (_currentStatus.HasFlag(Status.Sleeping))
            {
                pSystem.DrawBitmap(_sleep, 1, pos, scale);
            }
            else if (_currentStatus.HasFlag(Status.Hungry))
            {
                pSystem.DrawBitmap(_hungry, 1, pos, scale);
            }
            else if (_currentStatus.HasFlag(Status.Mating))
            {
                pSystem.DrawBitmap(_heart, 1, pos, scale);
            }
        }
示例#5
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawBitmap(_bitmap, 1, Position, Bounds.Size);
 }
示例#6
0
 protected override void DoDraw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawBitmap(Bitmap, 1, GameObject.ScreenPosition, GameObject.Scale * Game.ActiveCamera.Zoom);
 }