예제 #1
0
파일: canvas.cs 프로젝트: mnubbe/rope
    private void DrawHUD()
    {
        // Switch to orthographic.
        GL.Disable(EnableCap.DepthTest);
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        GL.LoadIdentity();
        GL.Ortho(0, Width, Height, 0, -5, 1);
        GL.MatrixMode(MatrixMode.Modelview);
        GL.LoadIdentity();

        string gfps_str = String.Format("graphics: {0} FPS",
                                        ((int)stats.GetFPS(FPS_TAG)));
        string pfps_str = String.Format("physics: {0} FPS",
                                        ((int)stats.GetFPS("physics")));

        //Note about printer: mono seems to have a memory leak from this unless it is manually .Dispose() 'd of
        //Or only a finite number of instances are made (1 from constructor seems fine)
        linenumber = 0;
        HUDprintLine(gfps_str);
        HUDprintLine(pfps_str);
        HUDprintLine(String.Format("Gamma: {0}", universe.bro.gamma));
        HUDprintLine(String.Format("Gamma*Vrms: {0}", universe.bro.gamma * universe.bro.vrms));
        HUDprintLine(String.Format("Vrms: {0}", universe.bro.vrms));
        HUDprintLine(String.Format("Your watch: {0:F3}", universe.bro.t_object));
        HUDprintLine(String.Format("Wall clock: {0:F3}", universe.universe_time));
        HUDprintLine(String.Format("Position: \n{0:F4}\n{1:F4}\n{2:F4}", universe.bro.x[0], universe.bro.x[1], universe.bro.x[2]));
        linenumber += 3;

        if (SHOULD_PRINT_RAPIDITY)
        {
            double[] rapidity = CoordinateEngine.Rapidity(universe.bro.v);
            //Print next to the position statement
            RectangleF m_rect = new RectangleF(50 + 100, 50 + 25 * (linenumber - 1), 500, 50);
            printer.Print(String.Format("Rapidity: \n{0:F4}\n{1:F4}\n{2:F4}", rapidity[0], rapidity[1], rapidity[2]),
                          font, Color.White, m_rect);
        }


        if (AM_USING_RETICLE)
        {
            HUDdrawReticle();
        }

        // Switch back.
        GL.Enable(EnableCap.DepthTest);
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Modelview);
    }