The frame rate per second (FPS or QPS) can be calculated as follows:
public void start() {
lastFPS = getTime();
}
public void updateFPS() {
if (getTime() - lastFPS > 1000) {
Display.setTitle("FPS: " + fps);
fps = 0; //reseta o contador de FPS
lastFPS += 1000; //adiciona um segundo
}
fps++;
}
The FPS representation is simple, it's how many frames were displayed in a single second. The frame rate per second is 30, which means that in one second, 30 frames were displayed.
The formula in a basic representation would be: FPS = (number of frames) / (number of seconds) . For example, if
120 seconds were displayed 6400 frames, our FPS would be ± 53,333 (6400/120).
The Display.setTitle(String title)
is for simplicity, showing the counter in the window title.
More information on the documentation .