예제 #1
0
        private void RenderText()
        {
            TextHelper txtHelper = new TextHelper(statsFont, textSprite, 15);
            txtHelper.Begin();
            txtHelper.SetInsertionPoint(5, 5);

            // Output statistics
            txtHelper.SetForegroundColor(System.Drawing.Color.Yellow);
            txtHelper.DrawTextLine("Stats---------------");

            frameCount++;
            if (frameCount == 100)
            {
                frameRate = 100 * 1000.0f / (Environment.TickCount - lastFrameTick);
                lastFrameTick = Environment.TickCount;
                frameCount = 0;
            }

            txtHelper.DrawTextLine("Avg Framerate: " + frameRate);
            if (remote != null)
            {
                txtHelper.DrawTextLine("Wii IR dots:" + remote.WiimoteState.IRState.Found1 + " "
                                                        + remote.WiimoteState.IRState.Found2 + " "
                                                      + remote.WiimoteState.IRState.Found3 + " "
                                                       + remote.WiimoteState.IRState.Found4);
            }
            if (remote2 != null)
            {
                txtHelper.DrawTextLine("Wii2 IR dots:" + remote2.WiimoteState.IRState.Found1 + " "
                                                        + remote2.WiimoteState.IRState.Found2 + " "
                                                      + remote2.WiimoteState.IRState.Found3 + " "
                                                       + remote2.WiimoteState.IRState.Found4);
            }

            txtHelper.DrawTextLine("Last Key Pressed: " + lastKey);
            txtHelper.DrawTextLine("Mouse X-Y: " + mouseCursor.X + ", " +mouseCursor.Y);
            txtHelper.DrawTextLine("Est Head X-Y (mm): " + headX * screenHeightinMM + ", " + headY * screenHeightinMM);
            txtHelper.DrawTextLine("Est Head Dist (mm): " + headDist*screenHeightinMM);
            txtHelper.DrawTextLine("Camera Vert Angle (rad): " + cameraVerticaleAngle);
            if(cameraIsAboveScreen)
                txtHelper.DrawTextLine("Camera Position: Above Screen");
            else
                txtHelper.DrawTextLine("Camera Position: Below Screen");
            txtHelper.DrawTextLine("Screen Height (mm) : " + screenHeightinMM);
            txtHelper.DrawTextLine("IR Dot Width (mm) : " + dotDistanceInMM);
            txtHelper.DrawTextLine("");

            txtHelper.DrawTextLine("Controls -----");
            txtHelper.DrawTextLine("Space - calibrate camera angle/center view");
            txtHelper.DrawTextLine("R - Reposition the targets");
            txtHelper.DrawTextLine("C - Toggle camera position above/below screen");
            txtHelper.DrawTextLine("esc - Quit");
            txtHelper.DrawTextLine("");

            txtHelper.DrawTextLine("Show--------");
            txtHelper.DrawTextLine("T - Targets");
            txtHelper.DrawTextLine("L - Lines");
            txtHelper.DrawTextLine("B - Background");
            txtHelper.DrawTextLine("M - Mouse Cursor");
            txtHelper.DrawTextLine("G - Grid");
            txtHelper.DrawTextLine("H - Help Text");
            txtHelper.DrawTextLine("");

            txtHelper.End();
        }
예제 #2
0
        /// <summary>
        /// Render the help and statistics text. This function uses the Font object for 
        /// efficient text rendering.
        /// </summary>
        private void RenderText(double appTime) {
            TextHelper txtHelper = new TextHelper(statsFont, textSprite, 15);

            // Output statistics
            txtHelper.Begin();
            txtHelper.SetInsertionPoint(2, 0);
            txtHelper.SetForegroundColor(unchecked((int)0xffffff00));
            if(isLogShowing) {
                txtHelper.DrawTextLine(NifFile.loadLog);
            } else {
                txtHelper.DrawTextLine(sampleFramework.FrameStats);
                txtHelper.DrawTextLine(sampleFramework.DeviceStats);
            }
            

            // Draw help
            if(isHelpShowing) {
                txtHelper.SetInsertionPoint(10, sampleFramework.BackBufferSurfaceDescription.Height-15*6);
                txtHelper.SetForegroundColor(unchecked((int)0xffffffff));
                txtHelper.SetForegroundColor(System.Drawing.Color.DarkOrange);
                txtHelper.DrawTextLine("Controls (F1 to hide):");

                txtHelper.SetInsertionPoint(20, sampleFramework.BackBufferSurfaceDescription.Height-15*5);
                txtHelper.DrawTextLine("Rotate model: Left mouse button");
                txtHelper.DrawTextLine("Rotate light: Right mouse button");
                txtHelper.DrawTextLine("Rotate camera: Middle mouse button");
                txtHelper.DrawTextLine("Zoom camera: Mouse wheel scroll");

                txtHelper.SetInsertionPoint(250, sampleFramework.BackBufferSurfaceDescription.Height-15*5);
                txtHelper.DrawTextLine("Move camera: Arrow keys");
                txtHelper.DrawTextLine("Reset camera: Home");
                txtHelper.DrawTextLine("Hide help: F1");
                txtHelper.DrawTextLine("Quit: Esc");
            } else {
                txtHelper.SetInsertionPoint(10, sampleFramework.BackBufferSurfaceDescription.Height-15*2);
                txtHelper.SetForegroundColor(unchecked((int)0xffffffff));
                txtHelper.DrawTextLine("Press F1 for help");
            }

            if(nif!=null&&!isLogShowing) {
                txtHelper.SetForegroundColor(unchecked((int)0xffffffff));
                txtHelper.SetInsertionPoint(2, 15*3);
                txtHelper.DrawTextLine(nifPath);
                if(subsetDesc!=null) txtHelper.DrawTextLine(subsetDesc);
            }

            txtHelper.End();
        }