attempt to correct the fps counter target values

This commit is contained in:
yugecin 2017-01-17 22:26:19 +01:00
parent b270015c14
commit 5e09a1d24a

View File

@ -43,16 +43,16 @@ public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
public void render(Graphics g) { public void render(Graphics g) {
int x = this.x; int x = this.x;
int target = displayContainer.targetRenderInterval - (displayContainer.targetUpdateInterval % displayContainer.targetRenderInterval); int target = displayContainer.targetRenderInterval + (displayContainer.targetUpdateInterval % displayContainer.targetRenderInterval);
x = drawText(g, getColor(target, displayContainer.renderDelta), (1000 / displayContainer.renderDelta) + " fps", x, this.y); x = drawText(g, getColor(target, displayContainer.renderDelta), (1000 / displayContainer.renderDelta) + " fps", x, this.y);
drawText(g, getColor(displayContainer.targetUpdateInterval, displayContainer.delta), (1000 / displayContainer.delta) + " ups", x, this.y); drawText(g, getColor(displayContainer.targetUpdateInterval, displayContainer.delta), (1000 / displayContainer.delta) + " ups", x, this.y);
} }
private Color getColor(int targetValue, int realValue) { private Color getColor(int targetValue, int realValue) {
if (realValue >= targetValue) { if (realValue <= targetValue) {
return GREEN; return GREEN;
} }
if (realValue >= targetValue * 0.9f) { if (realValue <= targetValue * 1.15f) {
return ORANGE; return ORANGE;
} }
return DARKORANGE; return DARKORANGE;