示例#1
0
文件: GameMenu.java 项目: Slyvr/DND
  public void render(SpriteBatch batch) {
    for (Ent e : this.getEnts()) {
      e.render(batch);
    }

    if (this.getCurrentSubMenu() != null) {
      this.getCurrentSubMenu().render(batch);
    }
  }
示例#2
0
文件: GameMenu.java 项目: Slyvr/DND
 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
文件: GameMenu.java 项目: Slyvr/DND
 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
文件: GameMenu.java 项目: Slyvr/DND
 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
文件: GameMenu.java 项目: Slyvr/DND
 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
文件: GameMenu.java 项目: Slyvr/DND
 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);
         }
       }
     }
   }
 }