Freetype for gwt
You ever wanted to use freetype on the web version of your game but couldn't? Now you can!
You have to use a matching libGDX and gdx-freetype-gwt version. See this table for compatibility.
libGDX | gdx-freetype-gwt | Note |
---|---|---|
1.9.11-SNAPSHOT | 1.9.11-SNAPSHOT | |
1.9.10 | 1.9.10.1 | Fixes https://github.com/intrigus/gdx-freetype-gwt/issues/9 |
1.9.10 | 1.9.10 | Don't use. Use 1.9.10.1 instead |
GdxDefinition.gwt.xml
in your html
subprojectAdd
<inherits name="com.badlogic.gdx.graphics.g2d.freetype.freetype-gwt" />
after
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
build.gradle
of the html
subprojectAdd
implementation "com.github.intrigus.gdx-freetype-gwt:gdx-freetype-gwt:$version"
implementation "com.github.intrigus.gdx-freetype-gwt:gdx-freetype-gwt:$version:sources"
HtmlLauncher.java
(or if it's not named so, modify the class in your html
project that extends GwtApplication
)Add
@Override
public void onModuleLoad () {
FreetypeInjector.inject(new OnCompletion() {
public void run () {
// Replace HtmlLauncher with the class name
// If your class is called FooBar.java than the line should be FooBar.super.onModuleLoad();
HtmlLauncher.super.onModuleLoad();
}
});
}
If gradle fails to resolve the dependency this most likely means that there no matching gdx-freetype-gwt version has been published.
You should try previous versions since freetype is generally updated rarely.
In any case open an issue.