Skip to content

Commit

Permalink
use default step interval of 64 for display updates
Browse files Browse the repository at this point in the history
otherwise it's too slow for any reasonable number of vessels
  • Loading branch information
nicolaspayette committed Nov 11, 2024
1 parent 635c28a commit 36fad3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
10 changes: 6 additions & 4 deletions gui/src/main/java/uk/ac/ox/poseidon/gui/DisplayWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import javax.swing.*;
import java.util.Map;

import static sim.display.Display2D.UPDATE_RULE_STEPS;

public abstract class DisplayWrapper<D, P extends FieldPortrayal> {

protected final String title;
protected final Map<String, Factory<? extends P>> portrayalFactories;
protected D display;
protected JFrame displayFrame;
private final String title;
final Map<String, Factory<? extends P>> portrayalFactories;
D display;
private JFrame displayFrame;

DisplayWrapper(
final String title,
Expand Down
12 changes: 9 additions & 3 deletions gui/src/main/java/uk/ac/ox/poseidon/gui/DisplayWrapper2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

public class DisplayWrapper2D extends DisplayWrapper<Display2D, FieldPortrayal2D> {

private static final int DEFAULT_STEP_INTERVAL = 64;

private final double width;
private final double height;
private final Paint backDrop;
Expand All @@ -50,9 +52,13 @@ public DisplayWrapper2D(

@Override
Display2D createDisplay(final GUIState guiState) {
final Display2D display = new Display2D(width, height, guiState);
display.setClipping(false);
return display;
return new Display2D(width, height, guiState) {
{
setClipping(false);
updateRule = UPDATE_RULE_STEPS;
stepInterval = DEFAULT_STEP_INTERVAL;
}
};
}

@Override
Expand Down

0 comments on commit 36fad3e

Please sign in to comment.