Beispiel #1
0
        public void Draw(Graphics graphics, Camera camera)
        {
            if (camera.Contains(_position))
            {
                camera.ApplyScreenRotation(graphics);

                PointF flameSource = RenderUtils.WorldToScreen(_position, camera.Bounds);
                flameSource.X -= (float)(40 / camera.Zoom);
                flameSource.Y += (float)(121 / camera.Zoom);

                float  scale    = (float)(_throttle / camera.Zoom);
                float  flameX   = (float)(Math.Cos(_retrograde) * scale);
                float  flameY   = (float)(Math.Sin(_retrograde) * scale);
                PointF flameTip = new PointF(flameSource.X + flameX, flameSource.Y + flameY);

                Color colSupersonic = Color.FromArgb(63, 195, 135, 255);
                //Brush brSupersonic = new SolidBrush(colSupersonic);

                //GraphicsPath graphPath = new GraphicsPath();
                //PointF corner1 = new PointF(flameSource.X - flameX / 10f, flameSource.Y + flameY / 10);
                //graphPath.AddLine(flameSource, corner1);
                //PointF corner2 = new PointF(flameTip.X - flameX / 10f, flameTip.Y + flameY / 10);
                //graphPath.AddLine(flameSource, corner2);
                //PointF corner3 = new PointF(flameTip.X + flameX / 10f, flameTip.Y - flameY / 10);
                //graphPath.AddLine(flameSource, corner3);
                //PointF corner4 = new PointF(flameSource.X + flameX / 10f, flameSource.Y - flameY / 10);
                //graphPath.AddLine(flameSource, corner4);

                //graphics.FillPath(brSupersonic, graphPath);

                graphics.DrawLine(new Pen(colSupersonic, scale / 50), flameSource, flameTip);

                graphics.ResetTransform();
            }
        }
Beispiel #2
0
        public void Draw(Graphics graphics, Camera camera, IMassiveBody parentBody)
        {
            var poweredTrails = new List <RectangleF>();
            var coastTrails   = new List <RectangleF>();

            for (int i = 0; i < _trailAngles.Count; i++)
            {
                double angle    = _trailAngles[i] + parentBody.Pitch;
                double distance = _trailDistances[i];

                DVector2 worldPoint = DVector2.FromAngle(angle) * distance + parentBody.Position;

                if (camera.Contains(worldPoint))
                {
                    PointF localPoint = RenderUtils.WorldToScreen(worldPoint, camera.Bounds);

                    if (_trailPowered[i])
                    {
                        poweredTrails.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                    else
                    {
                        coastTrails.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

            RenderUtils.DrawRectangles(graphics, poweredTrails, Color.Red);
            RenderUtils.DrawRectangles(graphics, coastTrails, Color.White);
        }