Add a clear function to String

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 9ba3105b1b
commit a3a2c62d4b
  1. BIN
      bin/RabiClone.jar
  2. 5
      src/sig/engine/String.java
  3. 8
      src/sig/objects/EditorRenderer.java

Binary file not shown.

@ -57,6 +57,11 @@ public class String{
return this.sb.indexOf(str); return this.sb.indexOf(str);
} }
public void clear() {
this.sb.setLength(0);
bounds = new Point(0,1);
}
/** /**
* Returns the index within this string of the first occurrence of the * Returns the index within this string of the first occurrence of the
* specified substring, starting at the specified index. * specified substring, starting at the specified index.

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

Loading…
Cancel
Save