/** * zoom to the card before or after the current zoomed card (direction = 1 for next, -1 for * previous) */ private void changeZoomedCard(int direction) { stopMakingSpace(); zoomCard.addAction(Actions.scaleTo(1.0f, 1.0f, 0.2f, Interpolation.pow2)); addCard(zoomCard, zoomReturnIndex); makeSpace(zoomReturnIndex + direction); zoomCard = (CardGroup) cards.getChildren().get(zoomReturnIndex + direction); zoomCard.clearActions(); zoomCard.remove(); addActor(zoomCard); zoomCard.setScale(3.0f); zoomCard.setPosition(600, 100); zoomReturnIndex += direction; updateZoomControls(); }
/** * brings the card up to the front and center, leaving a space where it belongs in the hand. * Nothing other than the card and its controls can be clicked during a zoom. Tapping the card * unzooms it. There also is a cancel, play, and rotate button, and arrows to see the next and * previous cards in the hand. * * @param toAdd card to zoom in on */ private void zoomCard(CardGroup toAdd) { zoomCard = toAdd; // remove toAdd from the hand and add it to the root zoomReturnIndex = cards.getChildren().indexOf(toAdd, true); zoomCard.remove(); addActor(zoomCard); makeSpace(zoomReturnIndex); zoomCard.getActions().clear(); // blow the card up zoomCard.addAction(Actions.scaleTo(3.0f, 3.0f, 0.2f, Interpolation.pow2)); // move it zoomCard.addAction(Actions.moveTo(600, 100, 0.2f, Interpolation.pow2)); // make only the zoom elements touchable for (Actor actor : getChildren()) { actor.setTouchable(Touchable.disabled); } zoomGroup.setTouchable(Touchable.enabled); zoomGroup.setVisible(true); updateZoomControls(); }