Reputation: 113
Does anyone know how to set the canvas full screen in HTML5 LibGDX?
I only find width and height property in GwtApplicationConfiguration
.
Upvotes: 6
Views: 1533
Reputation: 3183
I'm using a Stage so I had to use an InputMultiplexer to send input to both my Stage and the InputAdapter that handles fullscreen GWT requests.
InputAdapter webGlfullscreen = new InputAdapter() {
@Override
public boolean keyUp (int keycode) {
if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setDisplayMode(Gdx.graphics.getDisplayModes()[0]);
}
return true;
}
};
Gdx.input.setInputProcessor(new InputMultiplexer(webGlfullscreen, stage));
Upvotes: 1