maltaisn / msdf-gdx

Provides lightweight utilities to draw MSDF text on LibGDX
Apache License 2.0
35 stars 5 forks source link

Not GWT compatible - shaders unable to load in GWT at runtime #5

Open antzGames opened 7 months ago

antzGames commented 7 months ago

As described in https://libgdx.com/wiki/file-handling

public class MsdfShader extends ShaderProgram {

    public MsdfShader() {
        super(Gdx.files.classpath("font.vert"), Gdx.files.classpath("font.frag"));

is not supported at runtime in GWT.

image

My GWT project compiles fine, but running in the browser it fails with above message.

Work around is to copy the shaders from this library into my assets folder.

SimonIT commented 6 months ago

Hmm, libgdx is also using classpath for their shader. https://github.com/libgdx/libgdx/blob/ddc75209f30c3f6aa23d8888604663b09784320a/gdx/src/com/badlogic/gdx/graphics/g3d/shaders/DefaultShader.java#L395-L407 Maybe it works if we add something like this: https://github.com/libgdx/libgdx/blob/ddc75209f30c3f6aa23d8888604663b09784320a/gdx/res/com/badlogic/gdx.gwt.xml#L527-L528