Skip to content

Commit

Permalink
Remove FPS counter
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyers committed Jun 18, 2024
1 parent 9d16e47 commit aba9a9e
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions EU3_Scenario_Editor/src/editor/MapPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,7 @@ private void initComponents() {
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
// </editor-fold>

private double dirtyFPS;
private double cleanFPS;

public void checkFPS() {
long startTime = System.nanoTime();
for (int i = 0; i < 20; i++) {
isDirty = true;
paint(getGraphics());
}
long middleTime = System.nanoTime();
for (int i = 0; i < 100; i++) {
paint(getGraphics());
}
long endTime = System.nanoTime();

long averageDirtyFrame = (middleTime - startTime) / 20;
long averageCleanFrame = (endTime - middleTime) / 100;
dirtyFPS = 1000000000.0 / averageDirtyFrame;
cleanFPS = 1000000000.0 / averageCleanFrame;
repaint();
}


@Override
protected void paintComponent(final Graphics g) {
if (scaledMapImage == null) {
Expand All @@ -171,12 +149,6 @@ protected void paintComponent(final Graphics g) {
for (java.util.Map.Entry<Integer, Color> override : overrides.entrySet()) {
paintProvince((Graphics2D) g, override.getKey(), override.getValue());
}

g.setColor(Color.WHITE);
if (dirtyFPS > 0)
g.drawString(String.format("Dirty FPS: %.1f", dirtyFPS), 0, 10);
if (cleanFPS > 0)
g.drawString(String.format("Clean FPS: %.1f", cleanFPS), 0, 30);
}
}

Expand Down

0 comments on commit aba9a9e

Please sign in to comment.