コード例 #1
0
        public static void Render(
            GraphicsDevice graphics,
            Color color,
            float xpos   = 16f,
            float ypos   = 16f,
            int index    = -1,
            string label = "FPS")
        {
            if (index == -1)
            {
                FPSCounter.Tick(index);
            }
            if (!FPSCounter._initialized)
            {
                FPSCounter.Initialize(graphics);
            }
            int num = 0;

            if (FPSCounter._fpsValue.ContainsKey(index))
            {
                num = FPSCounter._fpsValue[index];
            }
            FPSCounter._batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, (Effect)null, (Microsoft.Xna.Framework.Matrix)Matrix.Identity);
            FPSCounter._biosFont.Draw(FPSCounter._batch, Convert.ToString(num, (IFormatProvider)CultureInfo.InvariantCulture) + " " + label, xpos, ypos, color);
            FPSCounter._batch.End();
        }
コード例 #2
0
 public static void DrawText(
     GraphicsDevice graphics,
     Color color,
     string text,
     float xpos = 16f,
     float ypos = 16f)
 {
     if (!FPSCounter._initialized)
     {
         FPSCounter.Initialize(graphics);
     }
     FPSCounter._batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, (Effect)null, (Microsoft.Xna.Framework.Matrix)Matrix.Identity);
     FPSCounter._biosFont.Draw(FPSCounter._batch, text, xpos, ypos, color);
     FPSCounter._batch.End();
 }