public void render(SpriteBatch batch) { for (Ent e : this.getEnts()) { e.render(batch); } if (this.getCurrentSubMenu() != null) { this.getCurrentSubMenu().render(batch); } }
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", ""); } } }
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", ""); } } }
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); } }
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); } } } } }
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); } } } } }