title: LibGDX - Only half of the screen is active playground
body: <p>I write a simple snake game using libgdx. Snake is starting to hide on the half of the screen.<a href="https://i.stack.imgur.com/9TVet.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9TVet.png" alt="screen of play ground" /></a>. How to change height of the playground? What can cause this issue?</p>
  <p>It seems like camera is not fullscreen as should be.</p>
  <p>GamePlay screen</p>
  <pre><code> public class GamePlay implements Screen {
          private Game game;
          private Stage stage;
          private GameState gameState = new GameState();
          private Viewport viewport;
          int width = Gdx.graphics.getWidth();
          int height = Gdx.graphics.getHeight();
          private OrthographicCamera camera = new OrthographicCamera(width, height);
      
      
          public GamePlay(Game aGame) {
              game = aGame;
              stage = new Stage(new ScreenViewport());
              camera.setToOrtho(false, width, height);
              viewport = new FitViewport(width, height, camera);
              Gdx.input.setInputProcessor(stage);
              viewport.apply();
          }
      
      
      
          @Override
          public void show() {
              Gdx.input.setInputProcessor(stage);
          }
      
          @Override
          public void render(float delta) {
              camera.update();
              viewport.apply();
      
              gameState.update(delta, viewport);
              Gdx.gl.glClearColor(1, 1, 1, 1);
              Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
              gameState.draw(width, height, camera);
          }
      
          @Override
          public void resize(int width, int height) {
              viewport.update(width, height);
          }
      }
  </code></pre>
  <p>GameState</p>
  <pre><code>public class GameState {
  
      private int playgroundSize = 30; //How many squares in the board
      private int yOffset = 0; //How high the board is off the bottom
      private ShapeRenderer shapeRenderer = new ShapeRenderer();
      private Buttons buttons = new Buttons();
      private Queue&lt;SnakeBody&gt; snakeBody = new Queue&lt;&gt;();
      private float timer = 0;
      private Candy candy = new Candy(playgroundSize);
      private int snakeSize = 10;
      private float colourCounter = 0;
  
      public GameState() {
          snakeBody.addLast(new SnakeBody(15, 15, playgroundSize)); //head
          snakeBody.addLast(new SnakeBody(15, 14, playgroundSize));
          snakeBody.addLast(new SnakeBody(15, 13, playgroundSize));
      }
  
      public void update(float delta, Viewport viewport) { //update game logic
          timer += delta;
          colourCounter += delta;
          buttons.update(viewport);
          if (timer &gt; 0.13f) {
              timer = 0;
              advance();
          }
      }
  
      private void advance() {
          int headX = snakeBody.first().getX();
          int headY = snakeBody.first().getY();
          switch (buttons.getDirection()) {
              //up
              case 1: //right
                  snakeBody.addFirst(new SnakeBody(headX + 1, headY, playgroundSize));
                  break;
              case 2: //down
                  snakeBody.addFirst(new SnakeBody(headX, headY - 1, playgroundSize));
                  break;
              case 3: //left
                  snakeBody.addFirst(new SnakeBody(headX - 1, headY, playgroundSize));
                  break;
              default://should never happen
                  snakeBody.addFirst(new SnakeBody(headX, headY + 1, playgroundSize));
                  break;
          }
          if (snakeBody.first().getX() == candy.getX() &amp;&amp; snakeBody.first().getY() == candy.getY()) {
              snakeSize++;
              candy.randomed(playgroundSize);
          }
  
  
          for (int i = 1; i &lt; snakeBody.size; i++) {
              if (snakeBody.get(i).getX() == snakeBody.first().getX()
                      &amp;&amp; snakeBody.get(i).getY() == snakeBody.first().getY()) {
                  snakeSize = 3;
              }
          }
  
          while (snakeBody.size - 1 &gt;= snakeSize) {
              snakeBody.removeLast();
          }
  
  
      }
  
  
      public void draw(float width, int height, OrthographicCamera camera) { //draw snake and board
          shapeRenderer.setProjectionMatrix(camera.combined);
          shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
  
          shapeRenderer.setColor(Color.PURPLE);
          shapeRenderer.rect(0, 0, width, height);
  
          shapeRenderer.setColor(Color.FOREST);
          shapeRenderer.setColor(MathUtils.sin(colourCounter), -MathUtils.sin(colourCounter), 1, 1);
  
  
          float scaleSnake = width / playgroundSize;
          shapeRenderer.rect(candy.getX() * scaleSnake, candy.getY() * scaleSnake, scaleSnake, scaleSnake);
  
          for (SnakeBody snBody : snakeBody) {
              shapeRenderer.rect(snBody.getX() * scaleSnake, snBody.getY() * scaleSnake, scaleSnake, scaleSnake);
          }
  
          shapeRenderer.end();
      }
  
  }
  </code></pre>
  <p>I checked i dont't use height/2 anywhere in this project, I don't understand how to resize it, please help!</p>