Exemplo n.º 1
0
        protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer)
        {
            Vector2 mp = base.GetMousePosition();

            mp = _camera.ViewToWorld(mp);


            renderer.BeginDraw(_camera);
            foreach (Polygon p in _polygons)
            {
                p.Draw(renderer);
            }

            renderer.DrawPoint(mp, _cursorSize, Color.Lerp(Color.Green, Color.Cyan, (_cursorSize - 2) / 2), 1f);

            if (_stage == 0)
            {
                renderer.DrawArrow(_forceStart, _forceEnd, 0.2f, Color.Green);
            }

            foreach (Arrow arrow in ArrowCollection.Arrows.Values)
            {
                renderer.DrawArrow(arrow.Start, arrow.End, 0.1f, arrow.Color);
            }

            renderer.DrawPoint(Vector2.Zero, 0.2f, Color.Red, 0.5f);

            renderer.EndDraw();
        }
Exemplo n.º 2
0
        protected override void DrawFrame(GameTime gameTime, XnaRenderer renderer)
        {
            renderer.Clear(Color.White);
            Vector2 start = new Vector2(0, 0);
            Vector2 end   = start + Util.AngleToVector(_angle) * _lineLength;

            renderer.BeginDraw(_camera);

            renderer.DrawPoint(start, 3f, Color.Green, 1f);
            renderer.DrawPoint(end, 3f, Color.Red, 1f);
            renderer.DrawArrow(start, end, 0.5f, Color.Black, 1f);

            renderer.EndDraw();
        }
Exemplo n.º 3
0
        public void Draw(XnaRenderer renderer)
        {
            //renderer.DrawPoint(ToWorld(_centerOfMass), 1f, Color.Red, 1f);
            renderer.Transformation = Matrix.CreateTranslation(-_centerOfMass.X, -_centerOfMass.Y, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateTranslation(_centerOfMass.X, _centerOfMass.Y, 0) * Matrix.CreateTranslation(Position.X, Position.Y, 0);
            renderer.DrawPoint(_centerOfMass, 1f, Color.Red, 1f);

            for (int i = 0; i < _points.Length; i++)
            {
                renderer.DrawPoint(_points[i], 1f, Color.White, 1f);

                //draw edge
                Vector2 start = _points[i];
                Vector2 end   = _points[(i + 1) % _points.Length];
                renderer.DrawLine(start, end, 0.1f, Color.White, 1f);
                //renderer.DrawArrow((start + end) * 0.5f, (start + end) * 0.5f + _normals[i] * 1f, 0.1f, Color.DarkGray, 0.6f);
            }

            renderer.Transformation = Matrix.Identity;
            renderer.DrawArrow(CenterOfMass, CenterOfMass + Velocity * 50f, 0.2f, Color.Blue);
        }