Skip to content Skip to sidebar Skip to footer

Libgdx Gwtapplication Exception (typeerror) In Html Deployment

I try to deploy my libgdx game in HTML. In desktop and Android it works well. When I do ./gradlew html:dist, it compile fine and I have a dist folder which is created in html folde

Solution 1:

For some reason,in HTML you can't use static method in new Runnable. So when you want to change your screen, you need to remove the fadeout:

button_stats.addListener(new ClickListener(){
    @Override
    publicvoidclicked(InputEvent event, float x, float y){
         ScreenManager.getInstance().showScreen(ScreenEnum.STATS);
    }
});

Or you can keep the fadeout but remove your static function and change screen directly:

SpeedRun2Game game;
...
button_stats.addListener(new ClickListener(){
    @Override
    publicvoidclicked(InputEvent event, float x, float y){

        stage.addAction(Actions.sequence(Actions.fadeOut(0.2f), Actions.run(new Runnable(){
            @Override
            publicvoidrun() {
                game.setScreen(new StatsScreen(game));
                }
        })));
    }
});

Post a Comment for "Libgdx Gwtapplication Exception (typeerror) In Html Deployment"