コード例 #1
0
ファイル: Game.cs プロジェクト: Azathotep/LiteEngineSamples
        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);
        }