Пример #1
0
  public void render(SpriteBatch batch) {
    for (Ent e : this.getEnts()) {
      e.render(batch);
    }

    if (this.getCurrentSubMenu() != null) {
      this.getCurrentSubMenu().render(batch);
    }
  }
Пример #2
0
 public void loadGame() {
   if (Gdx.input.justTouched()) {
     Rectangle mousePos = Utils.getMenuMousePos();
     Ent btnLoad = this.getEntByName("btnLoad");
     if (btnLoad.getPosBox().overlaps(mousePos)) {
       loadGameName = new TextInput();
       loading = true;
       Gdx.input.getTextInput(loadGameName, "Enter load game file name", "world1", "");
     }
   }
 }
Пример #3
0
 public void saveGame() {
   if (Gdx.input.justTouched()) {
     Rectangle mousePos = Utils.getMenuMousePos();
     Ent btnSave = this.getEntByName("btnSave");
     if (btnSave.getPosBox().overlaps(mousePos)) {
       saveGameName = new TextInput();
       saving = true;
       Gdx.input.getTextInput(saveGameName, "Enter save game file name", "world1", "");
     }
   }
 }
Пример #4
0
 public void updateDebugTooltip() {
   if (Game.getGlobal().getCurrentMenu().getName().equals("game")) {
     Ent debugTooltip = Game.getGlobal().getCurrentMenu().getEntByName("debugTooltip");
     String debugText = "";
     debugText += "\nFPS: " + Gdx.graphics.getFramesPerSecond();
     debugText += "\nCamX: " + Game.getGlobal().getCamera().position.x;
     debugText += "\nCamY: " + Game.getGlobal().getCamera().position.y;
     debugText += "\nTileSize: " + Game.getGlobal().getGame().getWorld().getTileSize();
     debugText +=
         "\nWorldSize: "
             + Game.getGlobal().getGame().getWorld().getWidth()
             + ","
             + Game.getGlobal().getGame().getWorld().getHeight();
     debugText += "\nWorldZoom: " + Game.getGlobal().getCamera().zoom;
     debugTooltip.setText(debugText);
   }
 }
Пример #5
0
 public void updateCreateCharacterButton() {
   if (Gdx.input.justTouched()) {
     Rectangle mousePos = Utils.getMenuMousePos();
     Ent btnAdd = this.getEntByName("btnAddCharacter");
     if (mousePos.overlaps(btnAdd.getPosBox())) {
       this.setCurrentSubMenu(this.getSubMenuByName("createcharacter"));
       Ent btnSelect = this.getEntByName("btnSelect");
       for (Ent btn : this.getEnts()) {
         if (btn.getName().contains("Tile") && btn.getName().contains("btn")) {
           if (btn.getName().equals("btnDeleteTile")) {
             btnSelect.setPosBox(new Rectangle(btn.getPosBox()));
           }
           btn.setState(State.NORMAL);
         }
       }
     }
   }
 }
Пример #6
0
 public void selectTile() {
   if (Gdx.input.justTouched()) {
     Rectangle mousePos = Utils.getMenuMousePos();
     Ent btnSelect = this.getEntByName("btnSelect");
     Ent selectedTile = null;
     for (Ent e : this.getEnts()) {
       if (e.getName().contains("btn") && e.getName().contains("Tile")) {
         if (mousePos.overlaps(e.getPosBox())) {
           e.setState(State.SELECTED);
           btnSelect.setPosBox(new Rectangle(e.getPosBox()));
           selectedTile = e;
         }
       }
     }
     if (selectedTile != null) {
       for (Ent e : this.getEnts()) {
         if (e.getName() != selectedTile.getName()) {
           e.setState(State.NORMAL);
         }
       }
     }
   }
 }