com.badlogic.gdx.scenes.scene2d.Touchable Java Examples
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.Touchable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SMoveTooltip.java From Unlucky with MIT License | 6 votes |
public SMoveTooltip(Skin skin, Label.LabelStyle ls) { super("", skin); this.ls = ls; desc = new Label("", skin); desc.setFontScale(0.5f); this.getTitleLabel().setFontScale(0.5f); left(); // fix padding because of scaling this.padTop(12); this.padLeft(2); this.padBottom(4); add(desc); pack(); this.setTouchable(Touchable.disabled); this.setVisible(false); this.setMovable(false); this.setOrigin(Align.bottomLeft); }
Example #2
Source File: DialogSceneComposerModel.java From skin-composer with MIT License | 6 votes |
public void reset() { name = null; alignment = Align.center; expand = false; fill = false; padLeft = 0; padRight = 0; padTop = 0; padBottom = 0; reverse = false; rowAlignment = Align.center; space = 0; wrap = false; wrapSpace = 0; children.clear(); touchable = Touchable.enabled; visible = true; }
Example #3
Source File: PlayerView.java From Cardshifter with Apache License 2.0 | 6 votes |
public PlayerView(CardshifterClientContext context, PlayerMessage message) { this.context = context; this.table = new Table(context.getSkin()); this.id = message.getId(); this.index = message.getIndex(); ResViewFactory rvf = new ResViewFactory(context.getSkin()); this.resources = rvf.forFormat(rvf.res("SCRAP"), rvf.str(" "), rvf.res("MANA"), rvf.str(" "), rvf.coloredRes("HEALTH", "MAX_HEALTH")); this.properties = new HashMap<String, Integer>(message.getProperties()); this.table.add(message.getName()).row(); this.table.add(this.resources.getActor()).row(); this.table.add(actions); table.setTouchable(Touchable.enabled); table.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { if (callback != null) { callback.addEntity(PlayerView.this); } } }); resources.update(properties); }
Example #4
Source File: Hud.java From Unlucky with MIT License | 6 votes |
/** * Creates the level descriptor window */ private void createLevelDescriptor() { levelDescriptor = new Window("", rm.skin); levelDescriptor.getTitleLabel().setFontScale(0.5f); levelDescriptor.getTitleLabel().setAlignment(Align.center); levelDescriptor.setMovable(false); levelDescriptor.setTouchable(Touchable.disabled); levelDescriptor.setKeepWithinStage(false); levelDescriptor.setVisible(false); levelDesc = new Label("", new Label.LabelStyle(rm.pixel10, Color.WHITE)); levelDesc.setFontScale(0.5f); levelDesc.setAlignment(Align.center); levelDescriptor.left(); levelDescriptor.padTop(12); levelDescriptor.padLeft(2); levelDescriptor.padBottom(4); levelDescriptor.add(levelDesc).width(70); stage.addActor(levelDescriptor); levelMoving = new Moving(new Vector2(), new Vector2(), 150.f); }
Example #5
Source File: PvpPlayState.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
private void showPrepareWindow() { new BlockingWindow() { @Override protected void doShow(IFuture<?> future) { super.doShow(future); table.setTouchable(Touchable.enabled); table.row(); table.add(new LocLabel("ui-waiting-another-player")); } @Override public boolean handleBackPressed() { if (isShown()) { callback.onCancel(session, Tuple3.make(false, Option.<String>none(), Option.<Throwable>none()), option(world), option(playersToParticipants)); hide(); } return true; } @Override protected boolean canBeClosed() { return true; } }.show(prepareFuture = new Future<Void>()); }
Example #6
Source File: MoveUI.java From Unlucky with MIT License | 6 votes |
/** * Hides and disables or shows and enables the move button UI */ public void toggleMoveAndOptionUI(boolean toggle) { for (int i = 0; i < 4; i++) { moveButtons[i].setTouchable(toggle ? Touchable.enabled : Touchable.disabled); moveButtons[i].setVisible(toggle); moveNameLabels[i].setVisible(toggle); moveDescLabels[i].setVisible(toggle); } for (int i = 0; i < 2; i++) { if (optionButtonTouchable[i]) optionButtons[i].setTouchable(toggle ? Touchable.enabled : Touchable.disabled); optionButtons[i].setVisible(toggle); optionNameLabels[i].setVisible(toggle); optionDescLabels[i].setVisible(toggle); } }
Example #7
Source File: PatchGrid.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
public PatchGrid(Skin skin, Color primaryColor, GridValues values) { this.primaryColor = new Color(primaryColor); this.values = values; setTouchable(Touchable.enabled); whiteDrawable = skin.getDrawable("white"); gridNodeDrawable = skin.getDrawable("custom/nine-patch-gird-node"); left = new PatchLine(whiteDrawable, primaryColor); right = new PatchLine(whiteDrawable, primaryColor); top = new PatchLine(whiteDrawable, primaryColor); bottom = new PatchLine(whiteDrawable, primaryColor); patchLines.addAll(left, right, top, bottom); addActor(left); addActor(right); addActor(top); addActor(bottom); lineDragListener = new LineDragListener(); addListener(lineDragListener); values.addListener(modelListener = new ModelChangeListener()); }
Example #8
Source File: CraftingPane.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
public boolean putIngredient(ItemIcon icon) { Vector2 stageCoordinates = icon.localToStageCoordinates(tmp.set(icon.getWidth() / 2, icon.getHeight() / 2)); Vector2 local = this.stageToLocalCoordinates(stageCoordinates); Actor actor = hit(local.x, local.y, true); if (actor != null && inputs.containsKey(actor)) { ItemIcon added = new ItemIcon(icon.item); addActor(added); added.setTouchable(Touchable.disabled); added.setPosition(actor.getX() + (actor.getWidth() - added.getWidth()) / 2, actor.getY() + (actor.getHeight() - added.getHeight()) / 2f); ItemIcon prev = inputs.put(actor, added); if (prev != null) { prev.setTouchable(Touchable.enabled); prev.remove(); fire(new IngredientReplaced(prev)); } updateResult(); return true; } else { return false; } }
Example #9
Source File: DiePane.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
public DiePane(Die die, UserData userData, Group diceWindowGroup) { this.die = die; this.userData = userData; this.diceWindowGroup = diceWindowGroup; shopComparator = Ability.shopComparator(die); setTransform(false); addActor(splitPane); splitPane.clearListeners(); initInfoPanel(); initParamsPanel(); splitPane.setSplitAmount(1f); splitPane.setHeight(info.getPrefHeight()); splitPane.layout(); setSize(getPrefWidth(), splitPane.getHeight()); params.setTouchable(Touchable.disabled); }
Example #10
Source File: CraftingPane.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
public CraftingPane(int elementsCount, Array<Ability> recipes) { super(Config.skin); this.inputs = new ObjectMap<Actor, ItemIcon>(elementsCount); this.count = elementsCount; this.recipes = recipes; // defaults().pad(2); for (int i = 0; i < elementsCount; i++) { Image image = new Image(Config.skin, "ui-crafting-slot"); image.setName("slot#" + i); inputs.put(image, null); add(image).size(26); if (i != elementsCount - 1) { add(new Tile("ui-plus")).pad(1); } else { add(new Tile("ui-equals")).pad(1); } } add(output).size(26); setTouchable(Touchable.enabled); }
Example #11
Source File: ItemTooltip.java From Unlucky with MIT License | 6 votes |
public ItemTooltip(Skin skin) { super("", skin); desc = new Label("", skin); desc.setFontScale(0.5f); this.getTitleLabel().setFontScale(0.5f); common = new Label.LabelStyle(skin.getFont("default-font"), new Color(1, 1, 1, 1)); rare = new Label.LabelStyle(skin.getFont("default-font"), new Color(0, 200 / 255.f, 0, 1)); epic = new Label.LabelStyle(skin.getFont("default-font"), new Color(0, 180 / 255.f, 1, 1)); legendary = new Label.LabelStyle(skin.getFont("default-font"), new Color(164 / 255.f, 80 / 255.f, 1, 1)); left(); // fix padding because of scaling this.padTop(12); this.padLeft(2); this.padBottom(4); add(desc); pack(); this.setTouchable(Touchable.disabled); this.setVisible(false); this.setMovable(false); this.setOrigin(Align.bottomLeft); }
Example #12
Source File: VisSplitPane.java From vis-ui with Apache License 2.0 | 5 votes |
@Override public Actor hit (float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; if (handleBounds.contains(x, y)) { return this; } else { return super.hit(x, y, touchable); } }
Example #13
Source File: BattleEventHandler.java From Unlucky with MIT License | 5 votes |
public void endDialog() { reset(); ui.setVisible(false); textLabel.setVisible(false); clickLabel.setVisible(false); clickLabel.setTouchable(Touchable.disabled); dialogIndex = 0; currentDialog = new String[0]; }
Example #14
Source File: ProfessionAbilityDescriptionWindow.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected void doShow(Params params) { Table content = new Table(Config.skin); content.defaults().pad(2); content.setBackground("ui-creature-info-background"); content.setTouchable(Touchable.enabled); table.add(content); Image image = new Image(Config.skin, "ability/" + params.ability.name + "-icon"); Image line = new Image(Config.skin, "ui-creature-info-line"); Thesaurus.Params dp = Thesaurus.params(); params.ability.fillDescriptionParams(dp, params.creature); Label desc = new LocLabel(params.ability.locDescKey(), dp); desc.setWrap(true); desc.setAlignment(Align.center); content.add(image).size(image.getWidth() * 2, image.getHeight() * 2).padBottom(-6).padTop(0).row(); content.add(new LocLabel(params.ability.locNameKey())).padBottom(3).row(); content.add(line).width(50).row(); content.add(desc).width(120).row(); if (!params.ability.requirement.isSatisfied(params.creature.description)) { Label label = new LocLabel(params.ability.requirement.describe(params.creature.description), StoreWindow.INACTIVE); label.setWrap(true); label.setAlignment(Align.center); content.add(label).padLeft(4).padRight(4).padBottom(3).width(120).row(); } }
Example #15
Source File: LevelUpScreen.java From Unlucky with MIT License | 5 votes |
public void start() { reset(); statsNum[0] = player.getMaxExp(); statsNum[1] = player.getAccuracy(); statsNum[2] = player.getMaxDamage(); statsNum[3] = player.getMinDamage(); statsNum[4] = player.getMaxHp(); increasedStats[0] = statsNum[0] + player.getMaxExpIncrease(); increasedStats[1] = statsNum[1] + player.getAccuracyIncrease(); increasedStats[2] = statsNum[2] + player.getMaxDmgIncrease(); increasedStats[3] = statsNum[3] + player.getMinDmgIncrease(); increasedStats[4] = statsNum[4] + player.getHpIncrease(); increases[0].setText("+" + player.getMaxExpIncrease()); increases[1].setText("+" + player.getAccuracyIncrease()); increases[2].setText("+" + player.getMaxDmgIncrease()); increases[3].setText("+" + player.getMinDmgIncrease()); increases[4].setText("+" + player.getHpIncrease()); for (int i = 0; i < 5; i++) { stats[i].setText(String.valueOf(statsNum[i])); } for (int i = 0; i < statNames.length; i++) { increases[i].setVisible(true); } ui.setTouchable(Touchable.enabled); // update information levelDesc.setText("You reached level " + player.getLevel()); }
Example #16
Source File: SpecialMoveScreen.java From Unlucky with MIT License | 5 votes |
/** * Shows the smove tooltip and enables the remove button * @param icon * @param index */ private void addSmoveEvent(final Image icon, final int index, final SpecialMove smove) { final Vector2 pos = getSlotPositions(index); icon.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { // unselect slots if (selectedSlot.isVisible()) { selectedSlot.setVisible(false); tooltip.setVisible(false); smoveButtons[1].setStyle(removeButtonStyle[1]); smoveButtons[1].setTouchable(Touchable.disabled); smoveToRemove = -1; } else { if (!game.player.settings.muteSfx) rm.invselectclick.play(game.player.settings.sfxVolume); // show selected slot selectedSlot.setPosition(pos.x, pos.y); selectedSlot.setVisible(true); // show tooltip Vector2 t = getTooltipCoords(pos, index); tooltip.show(smove, t.x, t.y); tooltip.toFront(); // enable remove button smoveButtons[1].setStyle(removeButtonStyle[0]); smoveButtons[1].setTouchable(Touchable.enabled); smoveToRemove = index; } } }); }
Example #17
Source File: DialogScreen.java From Unlucky with MIT License | 5 votes |
/** * Starts the text animation process given an array of Strings * Also takes in a BattleEvent that is called after the dialog is done * * @param dialog * @param next */ public void startDialog(String[] dialog, EventState prev, EventState next) { ui.setVisible(true); textLabel.setVisible(true); clickLabel.setVisible(true); clickLabel.setTouchable(Touchable.enabled); currentDialog = dialog; currentText = currentDialog[0]; anim = currentText.split(""); prevEvent = prev; nextEvent = next; beginCycle = true; }
Example #18
Source File: CCSpriteView.java From cocos-ui-libgdx with Apache License 2.0 | 5 votes |
@Override public Group widgetChildrenParse(CocoStudioUIEditor editor, ObjectData widget, Group parent, Actor actor) { Group group = super.widgetChildrenParse(editor, widget, parent, actor); group.setTouchable(Touchable.enabled); return group; }
Example #19
Source File: BeltGrid.java From riiablo with Apache License 2.0 | 5 votes |
private void updateItems(boolean hidden) { Touchable touchable = hidden ? Touchable.disabled : Touchable.enabled; SnapshotArray<Actor> snapshot = getChildren(); Actor[] children = snapshot.begin(); for (Actor child : children) { StoredItem item = (StoredItem) child; if (item == null) continue; if (item.getY() >= boxHeight) item.setTouchable(touchable); } snapshot.end(); }
Example #20
Source File: MundusMultiSplitPane.java From Mundus with Apache License 2.0 | 5 votes |
@Override public Actor hit(float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; if (getHandleContaining(x, y) != null) { return this; } else { return super.hit(x, y, touchable); } }
Example #21
Source File: InvitesWindow.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected void initialize() { Table content = new Table(Config.skin); content.setTouchable(Touchable.enabled); content.setBackground("ui-store-window-background"); content.add(new ScrollPane(list)).size(100, 100); table.add(content); }
Example #22
Source File: TextManagerUI.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public TextManagerUI(Skin skin, World w) { this.world = w; setTouchable(Touchable.disabled); styles = skin.getAll(TextManagerUIStyle.class); for (TextManagerUIStyle style : styles.values()) { style.font.getData().markupEnabled = true; } setVisible(false); }
Example #23
Source File: DialogSceneComposerModel.java From skin-composer with MIT License | 5 votes |
public void reset() { name = null; style = null; checked = false; disabled = false; color = null; padLeft = 0; padRight = 0; padTop = 0; padBottom = 0; touchable = Touchable.enabled; visible = true; }
Example #24
Source File: ToastManager.java From vis-ui with Apache License 2.0 | 5 votes |
/** Toast manager will create own group to host toasts and put it into the stage root. */ public ToastManager (Stage stage) { WidgetGroup widgetGroup = new WidgetGroup(); widgetGroup.setFillParent(true); widgetGroup.setTouchable(Touchable.childrenOnly); stage.addActor(widgetGroup); this.root = widgetGroup; }
Example #25
Source File: DialogSceneComposerModel.java From skin-composer with MIT License | 5 votes |
public void reset() { name = null; drawable = null; scaling = Scaling.stretch; touchable = Touchable.enabled; visible = true; }
Example #26
Source File: CreatureQueueWindow.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected void initialize() { creaturesList.defaults().pad(2); creaturesList.padTop(12); Image left = new Image(Config.skin, "ui-creature-queue-gradient-left"); left.setScaling(Scaling.stretchY); left.setAlign(Align.left); left.setTouchable(Touchable.disabled); Image right = new Image(Config.skin, "ui-creature-queue-gradient-right"); right.setScaling(Scaling.stretchY); right.setAlign(Align.right); right.setTouchable(Touchable.disabled); Stack stack = new Stack(); stack.add(new ScrollPane(creaturesList, new ScrollPane.ScrollPaneStyle())); stack.add(left); stack.add(right); Table content = new Table(Config.skin); content.setTouchable(Touchable.enabled); content.setBackground("ui-inventory-ability-window-background"); content.defaults().pad(2); content.add(new LocLabel("ui-turns-order")).row(); content.add(new Image(Config.skin, "ui-creature-info-line")).width(100).row(); content.add(stack).maxWidth(table.getStage().getWidth() - 45).padRight(4).padLeft(4).row(); table.add(content); }
Example #27
Source File: DialogScroller.java From riiablo with Apache License 2.0 | 5 votes |
public DialogScroller(DialogCompletionListener listener) { this.listener = listener; setTouchable(Touchable.disabled); //setDebug(true, true); textArea = new TextArea("", new TextArea.TextFieldStyle() {{ font = FONT; fontColor = Riiablo.colors.white; }}) { int count; float prefHeight; @Override public float getPrefHeight() { return prefHeight; } @Override public void setText(String str) { super.setText(str); count = StringUtils.countMatches(str, '\n'); prefHeight = count * getStyle().font.getLineHeight(); setHeight(getPrefHeight()); } }; scrollPane = new ScrollPane(textArea); scrollPane.setTouchable(Touchable.disabled); scrollPane.setSmoothScrolling(false); scrollPane.setFlickScroll(false); scrollPane.setFlingTime(0); scrollPane.setOverscroll(false, false); scrollPane.setClamp(false); scrollPane.setScrollX(-4); // FIXME: actual preferred width of text isn't calculated anywhere, this is best guess add(scrollPane).pad(PADDING).grow(); pack(); }
Example #28
Source File: ControlPanel.java From riiablo with Apache License 2.0 | 5 votes |
HealthWidget(TextureRegion background) { this.background = background; //setSize(background.getRegionWidth(), background.getRegionHeight()); setWidth(background.getRegionWidth()); health = hlthmana.getTexture(0); overlay = overlap.getTexture(0); setTouchable(Touchable.enabled); label = new Label(Riiablo.fonts.font16); label.setY(background.getRegionHeight()); label.setVisible(!DEBUG_MOBILE && Gdx.app.getType() == Application.ApplicationType.Desktop); }
Example #29
Source File: DialogSceneComposerModel.java From skin-composer with MIT License | 5 votes |
public void reset() { cells.clear(); name = null; background = null; color = null; padLeft = 0; padRight = 0; padTop = 0; padBottom = 0; paddingEnabled = false; alignment = Align.center; touchable = Touchable.enabled; visible = true; }
Example #30
Source File: CharacterSelectButton.java From riiablo with Apache License 2.0 | 5 votes |
public CharacterSelectButton(D2S d2s) { setSize(WIDTH, HEIGHT); setTouchable(Touchable.enabled); preview = new EntityWrapper(); title = new Label(Riiablo.fonts.font16); title.setColor(Riiablo.colors.gold); name = new Label(Riiablo.fonts.font16); name.setColor(Riiablo.colors.gold); levelClass = new Label(Riiablo.fonts.font16); expansion = new Label(Riiablo.fonts.font16); expansion.setColor(Riiablo.colors.green); Table previewColumn = new Table(); previewColumn.add(preview).width(72).growY(); Table textColumn = new Table(); textColumn.add(title).left().row(); textColumn.add(name).left().row(); textColumn.add(levelClass).left().row(); textColumn.add(expansion).left().row(); align(Align.topLeft); pad(4); add(previewColumn).growY(); add(textColumn).growX().top(); //setDebug(true, true); set(d2s); }