Skip to content

Commit

Permalink
Changable Framerate
Browse files Browse the repository at this point in the history
  • Loading branch information
Effyiex committed May 22, 2022
1 parent 81d92f7 commit c476374
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 11 additions & 1 deletion JWA-Source/de/prplx/jwa/JWebApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,22 @@ public void setHandshake(JWAHandshake handshake) {
this.handshake = handshake;
}

private int webFrameRate = 24;

public void setFramerate(int framerate) {
this.webFrameRate = framerate;
}

public int getFrameRate() {
return webFrameRate;
}

public void setWebInterface(String webInterface) {
this.webInterface = webInterface;
}

public String getWebInterface() {
return webInterface;
return webInterface.replace("/*FRAMERATE*/", String.valueOf(webFrameRate));
}

public void setDefaultScene(JWAScene scene) {
Expand Down
4 changes: 3 additions & 1 deletion JWA-Source/de/prplx/jwa/resources/WebInterface.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<title> loading... </title>
<script type="text/javascript">

const FRAMERATE = 24;
// JWebApplet (https://github.com/Effyiex/JWebApplet)

const FRAMERATE = /*FRAMERATE*/;

var appletCanvas;
var renderRoutine;
Expand Down
1 change: 1 addition & 0 deletions Test-App/de/prplx/jwa/JWATestApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static void main(String[] args) throws JWebApplet.PortAlreadyBoundExcepti
JWAScene scene = new JWAScene("TestLol", new Button("TestLol", "32p", "32p", "5%", "5%"));
scene.setBackground(Color.BLACK);
JWebApplet applet = new JWebApplet(80);
applet.setFramerate(30);
applet.setDefaultScene(scene);
applet.start();
}
Expand Down

0 comments on commit c476374

Please sign in to comment.