Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make html5 full screen in Libgdx?

Does anyone know how to set the canvas full screen in HTML5 LibGDX?

I only find width and height property in GwtApplicationConfiguration.

like image 923
henrywibowo Avatar asked Feb 08 '14 07:02

henrywibowo


1 Answers

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));
like image 175
Chase Avatar answered Oct 11 '22 15:10

Chase