Example usage for com.badlogic.gdx.utils.viewport Viewport getLeftGutterWidth

List of usage examples for com.badlogic.gdx.utils.viewport Viewport getLeftGutterWidth

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils.viewport Viewport getLeftGutterWidth.

Prototype

public int getLeftGutterWidth() 

Source Link

Document

Returns the left gutter (black bar) width in screen coordinates.

Usage

From source file:com.kasetagen.game.bubblerunner.screen.BubbleRunnerMenu.java

License:Creative Commons License

@Override
public void render(float delta) {
    stage.act(delta);/*from  w w w . j  a  va 2  s .co  m*/

    if (Gdx.graphics.isFullscreen()) {
        Viewport vp = stage.getViewport();
        int screenW = vp.getScreenWidth();
        int screenH = vp.getScreenHeight();
        int leftCrop = vp.getLeftGutterWidth();
        int bottomCrop = vp.getBottomGutterHeight();
        int xPos = leftCrop;
        int yPos = bottomCrop;

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        Gdx.gl.glViewport(xPos, yPos, screenW, screenH);
    }
    stage.draw();
}