Closed tommyettinger closed 5 years ago
Users of typing-label on GWT need to add this to their GdxDefinition.gwt.xml file:
<inherits name="com.rafaskoberg.gdx.typinglabel.typinglabel" />
<inherits name="regexodus"/>
And need to add dependencies on both typing-label's and RegExodus's sources jars, which is done in the GWT module's build.gradle (Change api to compile if using older Gradle. I don't know what typinglabelversion
will be, but some property should work, maybe 1.0.7
? You could also make a regexodusversion
if you want instead of 0.1.10):
api "com.github.tommyettinger:regexodus:0.1.10:sources"
api "com.rafaskoberg.gdx:typing-label:$typinglabelversion:sources"
This PR mainly switches from the barely-supported-on-GWT Java regexes to the pure-Java emulated regexes of RegExodus. It switches some StringBuffer instances to StringBuilder, since StringBuilder can be faster on desktop. This PR also rearranges the resources directory because it was inside a Java sources directory, which made my IntelliJ installation unable to see it at runtime.
Debugging this on GWT was not pretty, but thankfully RegExodus behaves almost identically on desktop and GWT, so I resolved the bugs on desktop before successfully testing in the browser. Although RegExodus is somewhat slower than java.util.regex, it actually might support some features that could be handy in other parts of typing-label, like if you wanted to check certain Unicode traits of a character to know how to animate it. I also did not notice any lag even on GWT, which tends to suffer hard from slow code, so the run-once parser probably isn't taking much time.
I hope this helps!