I'm trying to get this sample code to work (so I can figure out how it works). I'm fairly new to C# (As in I don't know anything).
The error I'm getting is: "The name 'label' is does not exist in the current context"
What am I doing wrong?
Also, is this the correct way to calculate frames per second?
using System;
using System.Collections.Generic;
using System.Text;
namespace VirtualRealm.Mdx.Common
{
public class Utility
{
#region Basic Frame Counter
private static int lastTick;
private static int lastFrameRate;
private static int frameRate;
public static int CalculateFrameRate()
{
label.Text = CalculateFrameRate().ToString();
if (System.Environment.TickCount - lastTick >= 1000)
{
lastFrameRate = frameRate;
frameRate = 0;
lastTick = System.Environment.TickCount;
}
frameRate++;
return lastFrameRate;
}
#endregion
}
}


Sign In
Create Account


Back to top









