Game update loop runs at a set rate.

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago committed by GitHub
parent a3a2c62d4b
commit 8a46cb56a6
  1. BIN
      bin/RabiClone.jar
  2. 2
      src/sig/RabiClone.java
  3. 7
      src/sig/engine/String.java
  4. 8
      src/sig/objects/EditorRenderer.java

Binary file not shown.

@ -90,7 +90,7 @@ public class RabiClone{
while (true) {
long timePassed = System.nanoTime()-lastGameTime;
lastGameTime=System.nanoTime();
double updateMult = Math.min(1/120d,timePassed/1000000000d);
double updateMult = 1/60d;
handleGameControllers();

@ -21,8 +21,13 @@ public class String{
this.sb=new StringBuilder(Double.toString(d));
updateBounds(Double.toString(d));
}
public String append(double d) {
this.sb.append(d);
updateBounds(Double.toString(d));
return this;
}
public String append(char c) {
this.sb=new StringBuilder(c);
this.sb.append(c);
updateBounds(Character.toString(c));
return this;
}

@ -80,12 +80,8 @@ public class EditorRenderer extends LevelRenderer{
if (messageLog.length()>0) {
if (System.currentTimeMillis()-last_message_log>MESSAGE_TIME) {
last_message_log=System.currentTimeMillis();
if (messageLog.length()>1) {
int secondMarker = messageLog.indexOf("\n",messageLog.indexOf("\n")+1);
messageLog.replace(messageLog.indexOf("\n"), secondMarker==-1?messageLog.length():secondMarker, "");
} else {
messageLog.clear();
}
int secondMarker = messageLog.indexOf("\n",messageLog.indexOf("\n")+1);
messageLog.replace(messageLog.indexOf("\n"), secondMarker==-1?messageLog.length():secondMarker, "");
}
}
}

Loading…
Cancel
Save