如何在Libgdx中使html5全屏显示?

hen*_*owo 6 browser gwt html5 libgdx

有谁知道如何在HTML5 LibGDX中将画布设置为全屏显示?

我只在中找到width和height属性GwtApplicationConfiguration

Cha*_*ase 1

我使用的是 Stage,因此必须使用 InputMultiplexer 将输入发送到 Stage 和处理全屏 GWT 请求的 InputAdapter。

    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));
Run Code Online (Sandbox Code Playgroud)