Example #1
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", "");
     }
   }
 }
Example #2
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", "");
     }
   }
 }
Example #3
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);
         }
       }
     }
   }
 }
Example #4
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);
         }
       }
     }
   }
 }