private void checkZoom() { if (zoomIn.isPressed() && !zoomIn.isDisabled()) { zoomOut.setDisabled(false); boolean canZoom = boardActor.zoomIn(ZOOM_RATE); if (!canZoom) { zoomIn.setDisabled(true); } } if (zoomOut.isPressed() && !zoomOut.isDisabled()) { zoomIn.setDisabled(false); boolean canZoom = boardActor.zoomOut(ZOOM_RATE); if (!canZoom) { zoomOut.setDisabled(true); } } }
private void fillTable() { StyleHelper helper = StyleHelper.getInstance(); Table leftTable = new Table(); ImageButton menu = new ImageButton( helper.getImageButtonStyleRound("widgets/icon-menu")); ImageButton hint = new ImageButton( helper.getImageButtonStyleRound("widgets/icon-hint")); zoomIn = new ImageButton( helper.getImageButtonStyleRound("widgets/icon-plus")); zoomOut = new ImageButton( helper.getImageButtonStyleRound("widgets/icon-minus")); Button goal = new ImageButton( helper.getImageButtonStyleRound("widgets/icon-goal")); ImageButton startSimulation = new ImageButton(StyleHelper.getInstance() .getImageButtonStyleRound("widgets/icon-next")); startSimulation.addListener(new StartSimulationListener()); // add listeners menu.addListener(new MenuClickListener()); hint.addListener(new HintClickListener()); leftTable.pad(30); leftTable.defaults().space(30); leftTable.add(menu).size(100).top().left(); leftTable.row(); // TODO only activated after some time leftTable.add(hint).expand().size(100).top().left(); leftTable.row(); leftTable.add(goal).expand().size(100).top().left(); leftTable.row(); leftTable.add(zoomIn).size(70).left(); leftTable.row(); leftTable.add(zoomOut).size(70).left(); final ColorController colorController = gameController .getColorController(); final ActorLayoutConfiguration config = new ActorLayoutConfiguration(); config.setColorController(colorController); boardActor = new BoardActor(gameController.getShownBoard(), config); boardActor.setColorBlindEnabled(game.getSettingController() .getCurrentSetting().isColorblindEnabled()); game.getSettingController().addSettingChangeListener(boardActor); // used to make resetting the board via game controller possible gameController.registerPlacementBoardEventListener(boardActor .getBoardEventListener()); final Table boardTable = new Table(); boardTable.add(boardActor).fill().expand(); final Table controlTable = new Table(); controlTable.add(leftTable).expand().fill(); if (gameController.getLevel().getShowObjectBar()) { boardActor.enableLayoutEditing( gameController.getPlacmentBoardEventListener(), true); ObjectBar objectBar = boardActor.getObjectBar(); objectBar.add(startSimulation).size(200); controlTable.add(objectBar).padLeft(30); } else { boardActor.enableLayoutEditing( gameController.getPlacmentBoardEventListener(), false); controlTable.add(startSimulation).bottom().right().size(200) .pad(30); } table.stack(boardTable, controlTable).fill().expand(); onSettingChange(game.getSettingController().getCurrentSetting()); BoardActor goalBoard = new BoardActor(gameController.getLevel() .getGoalBoard(), config); goalBoard.setZoomAndPanEnabled(false); goalBoard.setColorBlindEnabled(game.getSettingController() .getCurrentSetting().isColorblindEnabled()); game.getSettingController().addSettingChangeListener(goalBoard); Table goalTable = new Table(); goalTable.add(goalBoard).size(getViewportHeight()); goal.addListener(new GoalClickListener()); goalDialog.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { goalDialog.hide(); } }); goalDialog.add(goalTable).width(getViewportWidth() - 250) .height(getViewportHeight()); }