예제 #1
0
        public static void Render(CharRenderBuffer <float> buffer)
        {
            _lastRenderTick    = _currentRenderTick;
            _currentRenderTick = System.DateTime.Now.Ticks;

            LastFrameElapsed = (_currentRenderTick - _lastRenderTick) * 1e-7f;
            CurrentSecond    = (_currentRenderTick - _beginRenderTick) * 1e-7f;

            char[] outputChars = buffer.GetRenderBuffer();
            _renderingBufferWidth = buffer.Width;

            int cursorPos = _renderingBufferWidth - 1;

            if (CRenderSettings.IsCountFrames)
            {
                cursorPos = DisplayString(outputChars, DisplayNumber(outputChars, cursorPos, _frameCounts) - 1, "Frame:") - 1;
            }
            if (CRenderSettings.IsShowFPS)
            {
                cursorPos = DisplayString(outputChars, DisplayNumber(outputChars, cursorPos, (int)(1f / LastFrameElapsed)) - 1, "FPS:") - 1;
            }

            _frameCounts++;
            ConsoleExt.Output(outputChars);
        }
예제 #2
0
 public static void Render(CharRenderBuffer <float> buffer)
 {
     char[] outputChars = buffer.GetRenderBuffer();
     if (CRenderSettings.IsCountFrames)
     {
         _frameCounts++;
         for (int i = buffer.Width - 1, j = _frameCounts; j > 0; i--, j /= 10)
         {
             outputChars[i] = (char)(0x30 + (j % 10));
         }
     }
     ConsoleExt.Output(outputChars);
 }
예제 #3
0
        public static void Render(CharRenderBuffer <float> buffer)
        {
            char[] outputChars = buffer.GetRenderBuffer();
            int    cursorPos   = buffer.Width - 1;

            if (CRenderSettings.IsCountFrames)
            {
                cursorPos = DisplayString(outputChars, DisplayNumber(outputChars, cursorPos, _frameCounts) - 1, "Frame:") - 1;
            }
            if (CRenderSettings.IsShowFPS)
            {
                cursorPos = DisplayString(outputChars, DisplayNumber(outputChars, cursorPos, JMath.RoundToInt(1000f / DeltaMS)) - 1, "FPS:") - 1;
            }

            _frameCounts++;
            ConsoleExtension.Output(outputChars);
        }