Skip to content

GWT HTML Library Integration

Anton Chekulaev edited this page Aug 25, 2019 · 12 revisions

The library uses extended set of OpenGL functions, that is not implemented for the official HTML/GWT LibGDX backend. In order to activate them for a GWT module, the specific method should be called prior any library usage.

A. Add extra GWT dependencies

Add to your GWT module's build.gradle:

dependencies {
    implementation 'com.crashinvaders.vfx:gdx-vfx-core:0.4.0:sources'
    implementation 'com.crashinvaders.vfx:gdx-vfx-gwt:0.4.0'
    implementation 'com.crashinvaders.vfx:gdx-vfx-gwt:0.4.0:sources'

    // If you use "gdx-vfx-effects" library, don't forget to add this line.
    implementation 'com.crashinvaders.vfx:gdx-vfx-effects:0.4.0:sources'
}

B. Update your GWT configuration

Add these lines to your GdxDefinition.gwt.xml file:

<module ...>

    <!-- ... -->

    <inherits name='com.crashinvaders.vfx.GdxVfxCore' />
    <inherits name='com.crashinvaders.vfx.GdxVfxEffects' />   <!-- Optional, in case you use "gdx-vfx-effects" module -->
    <inherits name='com.crashinvaders.vfx.GdxVfxGwt' />

</module>

C. Activate GWT specific library code

Call GwtVfxGlExtension.initialize(); prior any library usage. The code best to be placed in a GWT module launcher class (the one that extends GwtApplication).

For example:

public class GwtLauncher extends GwtApplication {

    @Override
    public ApplicationListener createApplicationListener() {
	// ...

        GwtVfxGlExtension.initialize();    // <-- Add this line.

        return new MyApplicationListener();
    }
}
Clone this wiki locally