示例#1
0
        public static DisposeCallback RegisterBodyTracking(DemoOpenInfo info, Body body, Matrix2x3 transformation)
        {
            EventHandler handler = delegate(object sender, EventArgs e)
            {
                info.Viewport.ToScreen =
                    Matrix2x3.FromTranslate2D(new Vector2D(info.Viewport.X + info.Viewport.Width * .5f, info.Viewport.Y + info.Viewport.Height * .5f)) *
                    transformation *
                    body.Matrices.ToBody
                ;
            };

            body.PositionChanged += handler;
            return(delegate()
            {
                body.PositionChanged -= handler;
            });
        }