示例#1
0
    public TextButton getPlayButton() {
      // Generate a 1x1 white texture and store it in the skin named "white".
      playBtnPixmap.setColor(Color.GREEN);
      playBtnPixmap.fill();
      skin.add("white", new Texture(playBtnPixmap));

      // Store the default libgdx font under the name "default".
      BitmapFont bfont = new BitmapFont();
      // bfont.getData().scale(1.0f);;
      skin.add("default", bfont);

      // Configure a TextButtonStyle and name it "default". Skin resources are stored by type, so
      // this doesn't overwrite the font.
      TextButtonStyle textButtonStyle = new TextButtonStyle();
      textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
      textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);

      textButtonStyle.font = skin.getFont("default");

      skin.add("default", textButtonStyle);

      TextButton btn = new TextButton("Play game! \nTada", textButtonStyle);
      btn.setX(Gdx.graphics.getWidth() / 2 - btn.getWidth() / 2);
      btn.setY(Gdx.graphics.getHeight() / 2);

      return btn;
    }
示例#2
0
文件: GUI.java 项目: w4ll3/ppioo-1
  private static void loadButtons(Skin skin) {
    TextButtonStyle textButtonStyle;

    for (ColorEnum color : ButtonEnum.colors) {
      for (LabelEnum size : ButtonEnum.sizes) {
        for (ButtonEnum button : ButtonEnum.values()) {
          textButtonStyle = new TextButtonStyle();
          textButtonStyle.font = skin.getFont(size.fontName);
          textButtonStyle.fontColor = color.getColor();
          textButtonStyle.up = skin.getDrawable(button.type + ".up");
          textButtonStyle.over = skin.getDrawable(button.type + ".over");
          textButtonStyle.down = skin.getDrawable(button.type + ".down");
          if (ButtonEnum.defaultColor == color) {
            if (ButtonEnum.defaultSize == size) {
              skin.add(button.type, textButtonStyle);
            }
            skin.add(button.type + "." + size.fontName, textButtonStyle);
          }
          skin.add(button.type + "." + size.fontName + "." + color.colorName, textButtonStyle);
        }
      }
    }

    skin.add("default", skin.get("default.default.black", TextButtonStyle.class));
  }
    public void drawLabel(Skin skin) {
      if (percentageLbl != null) this.percentageLbl.remove();

      String lifeString = String.valueOf((int) (percentage * 100)) + "%";
      this.percentageLbl = new Label(lifeString, skin);
      this.percentageLbl.setX(this.getX() + 400);
      this.percentageLbl.setY(this.getY() + 20);
      this.percentageLbl.setStyle(new LabelStyle(skin.getFont("andalus-font"), Color.WHITE));
      if (this.getStage() != null) this.getStage().addActor(percentageLbl);
    }
示例#4
0
  public void create() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    Label nameLabel = new Label("Name:", skin);
    TextField nameText = new TextField("", skin);
    Label addressLabel = new Label("Address:", skin);
    TextField addressText = new TextField("", skin);

    Table table = new Table();
    stage.addActor(table);
    table.setSize(260, 195);
    table.setPosition(190, 142);
    // table.align(Align.right | Align.bottom);

    table.debug();

    TextureRegion upRegion = skin.getRegion("default-slider-knob");
    TextureRegion downRegion = skin.getRegion("default-slider-knob");
    BitmapFont buttonFont = skin.getFont("default-font");

    TextButton button = new TextButton("Button 1", skin);
    button.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 1");
            return false;
          }
        });
    table.add(button);
    // table.setTouchable(Touchable.disabled);

    Table table2 = new Table();
    stage.addActor(table2);
    table2.setFillParent(true);
    table2.bottom();

    TextButton button2 = new TextButton("Button 2", skin);
    button2.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            System.out.println("2!");
          }
        });
    button2.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 2");
            return false;
          }
        });
    table2.add(button2);
  }
示例#5
0
  public static void createSkin() {
    /// Create a font
    BitmapFont font = new BitmapFont();
    skin = new Skin();
    skin.add("default", font);

    /// Create a texture
    Pixmap pixmap =
        new Pixmap(
            (int) Gdx.graphics.getWidth() / 4,
            (int) Gdx.graphics.getHeight() / 10,
            Pixmap.Format.RGB888);
    pixmap.setColor(Color.RED);
    pixmap.fill();
    skin.add("background", new Texture(pixmap));

    /// Create a button style
    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("background", Color.GRAY);
    textButtonStyle.down = skin.newDrawable("background", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("background", Color.DARK_GRAY);
    textButtonStyle.over = skin.newDrawable("background", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    /// Create Title Style
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.fontColor = Color.RED;
    Pixmap titlePixmap =
        new Pixmap(
            (int) Gdx.graphics.getWidth() / 4,
            (int) Gdx.graphics.getHeight() / 10,
            Pixmap.Format.RGB888);
    titlePixmap.setColor(Color.CLEAR);
    titlePixmap.fill();
    skin.add("titleBackground", new Texture(titlePixmap));
    labelStyle.background = skin.newDrawable("titleBackground", Color.CLEAR);
    labelStyle.font = skin.getFont("default");
    font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Nearest);
    skin.add("default", labelStyle);
  }
示例#6
0
  private void loadHUD() {
    Skin skin = new Skin();
    TextButtonStyle style = new TextButton.TextButtonStyle();
    skin.add("default", new BitmapFont());
    style.font = skin.getFont("default");
    skin.add("default", style);

    TextButton button1 = new TextButton("HUD-Label1", skin);
    uiStage.addActor(button1);
    button1.setPosition(camera.viewportWidth / 2 - 100, 0);
    button1.setBounds(button1.getX(), button1.getY(), button1.getWidth(), button1.getHeight());

    uiStage.addActor(new TextButton("HUD-Label2", skin));
  }
示例#7
0
  public AbilityPanel(Skin skin, Stage stage) {
    super(
        skin,
        stage,
        AssetManager.loadSprite("GUI/TileBackground"),
        AssetManager.loadSprite("GUI/TileBorder"),
        1,
        Global.NUM_ABILITY_SLOTS,
        48,
        false);

    drawHorizontalBackground = false;
    font = skin.getFont("default");
    padding = 10;

    this.white = AssetManager.loadTextureRegion("Sprites/white.png");
    passiveTileBorder = AssetManager.loadTextureRegion("Sprites/GUI/PassiveTileBorder.png");
  }
示例#8
0
文件: GUI.java 项目: w4ll3/ppioo-1
  private static void loadLabels(Skin skin) {
    Label.LabelStyle labelStyle;

    for (ColorEnum color : LabelEnum.colors) {
      for (LabelEnum label : LabelEnum.values()) {
        labelStyle = new Label.LabelStyle();
        labelStyle.font = skin.getFont(label.fontName);
        labelStyle.fontColor = color.getColor();
        labelStyle.background = skin.getDrawable("transparent");
        if (LabelEnum.defaultColor == color) {
          skin.add(label.fontName, labelStyle);
        }
        skin.add(label.fontName + "." + color.colorName, labelStyle);
      }
    }

    skin.add("default", skin.get("default.black", LabelStyle.class));
  }
示例#9
0
 public ToggleBox(String text, Skin skin) {
   this.text = text;
   this.skin = skin;
   font = skin.getFont("default-font");
   checked = skin.getDrawable("check-on");
   active = skin.getDrawable("check-off");
   setTouchable(Touchable.enabled);
   addListener(
       new ClickListener() {
         public void clicked(InputEvent ev, float x, float y) {
           setSelected(!isSelected());
         }
       });
   TextBounds fb = font.getBounds(text);
   setSize(
       checked.getMinWidth() + pad + fb.width,
       Math.max(checked.getMinHeight(), font.getCapHeight()));
 }
    void initialize() {
      skin.getFont("default").getData().markupEnabled = true;

      for (int i = 0; i < 6; i++) trackButtons.add(new TextButton(i + "", skin, "toggle"));

      animationList.getSelection().setRequired(false);

      premultipliedCheckbox.setChecked(true);

      loopCheckbox.setChecked(true);

      scaleSlider.setValue(1);
      scaleSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.01f);

      mixSlider.setValue(0.3f);
      mixSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.1f);

      speedSlider.setValue(1);
      speedSlider.setSnapToValues(new float[] {0.5f, 0.75f, 1, 1.25f, 1.5f, 2, 2.5f}, 0.1f);

      alphaSlider.setValue(1);
      alphaSlider.setDisabled(true);

      window.setMovable(false);
      window.setResizable(false);
      window.setKeepWithinStage(false);
      window.setX(-3);
      window.setY(-2);

      window.getTitleLabel().setColor(new Color(0.76f, 1, 1, 1));
      window.getTitleTable().add(openButton).space(3);
      window.getTitleTable().add(minimizeButton).width(20);

      skinScroll.setFadeScrollBars(false);

      animationScroll.setFadeScrollBars(false);
    }
示例#11
0
文件: GUI.java 项目: w4ll3/ppioo-1
  public static void configureSkin(Skin skin) {
    if (skin == null) {
      return;
    }

    loadResources(skin);
    loadLabels(skin);
    loadButtons(skin);

    ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle();
    scrollPaneStyle.background = skin.newDrawable("white", Color.BLACK);
    scrollPaneStyle.hScroll = skin.newDrawable("white8x1", Color.GRAY);
    scrollPaneStyle.hScrollKnob = skin.newDrawable("white8x1", Color.WHITE);
    scrollPaneStyle.vScroll = skin.newDrawable("white1x8", Color.GRAY);
    scrollPaneStyle.vScrollKnob = skin.newDrawable("white1x8", Color.WHITE);
    scrollPaneStyle.corner = skin.newDrawable("white", Color.GRAY);
    skin.add("default", scrollPaneStyle);

    CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle();
    checkBoxStyle.font = skin.getFont("default");
    checkBoxStyle.fontColor = Color.BLACK;
    checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on");
    checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled");
    checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off");
    checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled");
    skin.add("default", checkBoxStyle);

    checkBoxStyle = new CheckBox.CheckBoxStyle();
    checkBoxStyle.font = skin.getFont("default");
    checkBoxStyle.fontColor = Color.BLACK;
    checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on.slider.horizontal");
    // checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled");
    checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off.slider.horizontal");
    // checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled");
    skin.add("slider.horizontal", checkBoxStyle);

    Window.WindowStyle dialogStyle = new Window.WindowStyle();
    dialogStyle.background = skin.newDrawable("window");
    dialogStyle.stageBackground = skin.newDrawable("white", Color.valueOf("00000080"));
    dialogStyle.titleFont = skin.getFont("medium");
    dialogStyle.titleFontColor = Color.BLACK;
    skin.add("default", dialogStyle);

    ImageButton.ImageButtonStyle upButtonStyle = new ImageButton.ImageButtonStyle();
    upButtonStyle.imageUp = skin.getDrawable("arrow.up");
    upButtonStyle.imageDown = skin.getDrawable("arrow.up");
    upButtonStyle.imageDisabled = skin.getDrawable("arrow.up.disabled");
    skin.add("arrow.up", upButtonStyle);

    ImageButton.ImageButtonStyle downButtonStyle = new ImageButton.ImageButtonStyle();
    downButtonStyle.imageUp = skin.getDrawable("arrow.down");
    downButtonStyle.imageDown = skin.getDrawable("arrow.down");
    downButtonStyle.imageDisabled = skin.getDrawable("arrow.down.disabled");
    skin.add("arrow.down", downButtonStyle);

    ImageButton.ImageButtonStyle radioButtonStyle = new ImageButton.ImageButtonStyle();
    radioButtonStyle.imageUp = skin.getDrawable("radiobutton.off");
    radioButtonStyle.imageOver = skin.getDrawable("radiobutton.off.over");
    radioButtonStyle.imageChecked = skin.getDrawable("radiobutton.on");
    radioButtonStyle.imageCheckedOver = skin.getDrawable("radiobutton.on.over");
    radioButtonStyle.imageDisabled = skin.getDrawable("radiobutton.disabled");
    skin.add("radiobutton", radioButtonStyle);
  }
示例#12
0
  @Override
  public void show() {
    openingtheme.play();
    openingtheme.setLooping(true);
    // openingtheme.setVolume(game.state.volume);
    batch = new SpriteBatch();

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    // Straight up stolen from https://www.pinterest.comore
    //        img = new Texture("menubackground1.png");
    img = new Texture("menu_background_fix.png");
    titleimg = new Texture("SlashHeroesTitle.png");
    img.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    // change these numbers around so it looks good on the presentation phone
    TextureRegion region = new TextureRegion(img, 0, 0, 600, 400);
    sprite = new Sprite(region);
    sprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    sprite.setOrigin(0, 0);

    skin = new Skin();
    // Generate a 1x1 white texture and store it in the skin named "white".
    Pixmap pixmap = new Pixmap(320, 75, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.GREEN);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    // create the custom font
    FreeTypeFontGenerator generator =
        new FreeTypeFontGenerator(Gdx.files.internal("fonts/slkscre.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter =
        new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 80;
    BitmapFont OurFont = generator.generateFont(parameter);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    // add ourfont to the skin for our buttons.
    skin.add("default", OurFont);

    // textbuttonstyle wont overwrite the font
    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");

    skin.add("default", textButtonStyle);

    // Create a button with the "default" TextButtonStyle.
    final TextButton PlayButton = new TextButton("PLAY", textButtonStyle);
    // final TextButton ContinueButton = new TextButton("Continue",textButtonStyle);
    final TextButton SettingsButton = new TextButton("Mute", textButtonStyle);
    final TextButton QuitButton = new TextButton("Quit", textButtonStyle);
    PlayButton.setPosition(Gdx.graphics.getWidth() / 2 - 160, Gdx.graphics.getHeight() / 2 - 150);
    // ContinueButton.setPosition(Gdx.graphics.getWidth()/2 - 160, Gdx.graphics.getHeight()/2 - 85);
    //        SettingsButton.setPosition(Gdx.graphics.getWidth()/2 - 160, Gdx.graphics.getHeight()/2
    // - 165);
    SettingsButton.setPosition(
        Gdx.graphics.getWidth() / 2 - 160, Gdx.graphics.getHeight() / 2 - 300);
    //        QuitButton.setPosition(Gdx.graphics.getWidth()/2 - 160, Gdx.graphics.getHeight()/2 -
    // 245);
    QuitButton.setPosition(Gdx.graphics.getWidth() / 2 - 160, Gdx.graphics.getHeight() / 2 - 450);
    stage.addActor(PlayButton);
    // stage.addActor(ContinueButton);
    stage.addActor(SettingsButton);
    stage.addActor(QuitButton);

    PlayButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            select.play();
            PlayButton.setText("Starting new game");
            openingtheme.stop();
            game.setScreen(game.introscreen);
          }
        });
    SettingsButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            // System.out.println("Clicked! Is checked: " + button.isChecked());
            select.play();
            if (game.state.volume == 0f) {
              game.state.volume = .7f;
              openingtheme.play();
              openingtheme.setVolume(game.state.volume);
              SettingsButton.setText("Mute");
            } else {
              game.state.volume = 0f;
              openingtheme.stop();
              SettingsButton.setText("Unmute");
            }

            // TODO make this mute and unmute the non existant sound
            // mute and unmute;
          }
        });
    QuitButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            select.play();
            openingtheme.stop();
            QuitButton.setText("Quitting");
            // TODO make this quit the correct way
            System.exit(0);
          }
        });
  }
  @Override
  public void create() {
    skin = new Skin(Gdx.files.internal(SKIN));

    EditorLogger.setDebug();
    EditorLogger.debug("CREATE");
    Ctx.project = new Project();
    Ctx.msg = new Message(skin);
    Ctx.assetManager = new EditorAssetManager();

    scnEditor = new ScnEditor(skin);
    skin.getFont("default-font").getData().markupEnabled = true;

    /** * STAGE SETUP ** */
    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);

    // RIGHT PANEL
    ScenePanel scenePanel = new ScenePanel(skin);
    ActorPanel actorPanel = new ActorPanel(skin);

    Table rightPanel = new Table();
    rightPanel.top().left();
    //		rightPanel.add(scenePanel).expand().fill();
    //		rightPanel.row();
    rightPanel.add(actorPanel).expand().fill();

    SplitPane splitPaneRight = new SplitPane(scnEditor, rightPanel, false, skin);

    // LEFT PANEL
    ProjectPanel projectPanel = new ProjectPanel(skin);
    //		AssetPanel assetPanel = new AssetPanel(skin);
    Image img = new Image(Ctx.assetManager.getIcon("title"));
    img.setScaling(Scaling.none);
    img.setAlign(Align.left);

    Table leftPanel = new Table();
    leftPanel.top().left().padLeft(10);
    leftPanel.add(img).expand().fill().padBottom(20).padTop(20).padLeft(20);
    leftPanel.row();
    leftPanel.add(new ProjectToolbar(skin)).expandX().fill();
    leftPanel.row();
    leftPanel.add(projectPanel).expand().fill();
    leftPanel.row();
    leftPanel.add(scenePanel).expand().fill();

    SplitPane splitPaneLeft = new SplitPane(leftPanel, splitPaneRight, false, skin);
    splitPaneLeft.setFillParent(true);
    splitPaneLeft.setSplitAmount(0.3f);
    stage.addActor(splitPaneLeft);

    // LOAD LAST OPEN PROJECT
    String lastProject = Ctx.project.getEditorConfig().getProperty(Project.LAST_PROJECT_PROP, "");

    if (!lastProject.isEmpty() && new File(lastProject).exists()) {
      try {
        EditorLogger.debug("Loading last project: " + lastProject);
        Ctx.project.loadProject(new File(lastProject));
      } catch (Exception e) {
        EditorLogger.debug("Error loading last project: " + e.getMessage());
        Ctx.project.closeProject();
        e.printStackTrace();
      }
    }

    stage.setScrollFocus(scnEditor.getScnWidget());
    stage.setKeyboardFocus(scnEditor.getScnWidget());
  }
示例#14
0
  public MainMenuScreen(final SpaceLord2Game game, final ActionResolver resolver) {
    this.game = game;
    this.resolver = resolver;

    this.game.font = new BitmapFont();
    this.game.font.getData().scale(3);
    this.game
        .font
        .getRegion()
        .getTexture()
        .setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

    title = new Texture(Gdx.files.internal("space_lord_2_title.png"));

    backGround = new BackGround();

    table = new Table();
    table.defaults().width(600).padBottom(100);

    stage = new Stage(new FitViewport(GameConstants.GAME_WIDTH, GameConstants.GAME_HEIGHT));

    Gdx.input.setInputProcessor(stage);

    launchSound = Gdx.audio.newSound(Gdx.files.internal("sounds/space.mp3"));

    buttonClick = Gdx.audio.newSound(Gdx.files.internal("sounds/button_click.mp3"));

    skin = new Skin();
    skin.add("default", game.font);
    Pixmap pixmap = new Pixmap(100, 100, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.GRAY);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    // Configure a TextButtonStyle and name it "default". Skin resources are stored by type, so this
    // doesn't overwrite the font.
    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.WHITE);
    textButtonStyle.checked = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);

    textButtonStyle.font = skin.getFont("default");

    skin.add("default", textButtonStyle);

    // Create a button with the "default" TextButtonStyle. A 3rd parameter can be used to specify a
    // name other than "default".
    final TextButton playButton = new TextButton("Play", textButtonStyle);
    table.add(playButton);
    table.row();

    final TextButton leaderboardButton = new TextButton("Leaderboard", textButtonStyle);
    table.add(leaderboardButton);
    table.row();

    final TextButton achievementButton = new TextButton("Achievements", textButtonStyle);
    table.add(achievementButton);
    table.row();

    signInButton = new TextButton("Sign In", textButtonStyle);

    table.add(signInButton);
    table.row();

    table.setPosition(GameConstants.GAME_WIDTH / 3, (GameConstants.GAME_HEIGHT / 5) * 2);

    stage.addActor(table);

    playButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            buttonClick.play();
            game.setScreen(new SpaceLord2(game, resolver));
            dispose();
          }
        });

    leaderboardButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            resolver.showLeaderboard();
          }
        });

    achievementButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            resolver.showAchievements();
          }
        });

    signInButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            buttonClick.play();
            resolver.signIn();
          }
        });

    camera = new OrthographicCamera();
    viewport = new FitViewport(GameConstants.GAME_WIDTH, GameConstants.GAME_HEIGHT, camera);
    viewport.apply();
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
  }