public ObjectEditor(Scene scene, String objectName) { this.scene = scene; top = new Table(); top.add(new VisLabel(objectName)).expandX().pad(0, 20, 0, 20); VisTextButton deleteObject = new VisTextButton("Delete"); deleteObject.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { hasDeleteBeenPressed = true; delete(); } }); top.add(deleteObject).pad(0, 20, 0, 20); add(top).padTop(80).colspan(4).row(); bottom = new Table(); }
@Override protected void initialize() { Table topButtonBar = new Table(); topButtonBar.setFillParent(true); VisTextButton showEditorButton = new VisTextButton("Show Editor"); showEditorButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { showEditorClicked(); } }); topButtonBar.top().left().add(showEditorButton).pad(7); Table bottomButtonBar = new Table(); bottomButtonBar.setFillParent(true); stage.addActor(topButtonBar); }
private Table setupRedDiceOption(int diceNumber) { Table redDiceOption = new Table(); redDiceOption.setBackground(redBackground); redDiceOption.add(new Label("" + diceNumber, CatanGame.skin)); redDiceOption.setTouchable(Touchable.enabled); redDiceOption.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { if (chosenRedDice == diceNumber) { System.out.println("discard choice of " + diceNumber); chosenRedDice = 0; enableAllTouchablesRed(); } else { System.out.println("choose " + diceNumber); chosenRedDice = diceNumber; disableAllTouchablesRed(); redDiceOption.setTouchable(Touchable.enabled); redDiceOption.setBackground(redBackground); } } }); return redDiceOption; }
private Table setupYellowDiceOption(int diceNumber) { Table yellowDiceOption = new Table(); yellowDiceOption.setBackground(yellowBackground); yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin)); yellowDiceOption.setTouchable(Touchable.enabled); yellowDiceOption.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { if (chosenYellowDice == diceNumber) { System.out.println("discard choice of " + diceNumber); chosenYellowDice = 0; enableAllTouchablesYellow(); } else { System.out.println("choose " + diceNumber); chosenYellowDice = diceNumber; disableAllTouchablesYellow(); yellowDiceOption.setTouchable(Touchable.enabled); yellowDiceOption.setBackground(yellowBackground); } } }); return yellowDiceOption; }
/** * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized. * It also adds Listeners to the Skins' Buttons. * * @param table Table where the Skins' Labels and Buttons will be organized. */ private void createSkins(Table table) { for (int i = 0; i < game.getNumSkins(); ++i) { //Adding Buttons and Labels to the Arrays skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class))))); skinLabels.add(new Label("Current", skin1)); final int j = i; //Needed for Listener initialization skinButtons.get(i).addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { setCurrentLabel(j); } }); table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE); } table.row(); for (int i = 0; i < game.getNumSkins(); ++i) table.add(skinLabels.get(i)); initializeCurrentSkin(); }
/** * Function used to initialize all the elements of the HUD and add the respective Listeners. */ private void initHUD() { Table hudTable = new Table(); hudTable.setFillParent(true); Button pauseButton = new Button(new TextureRegionDrawable( new TextureRegion(game.getAssetManager().get("pause.png", Texture.class)))); scoreText = new Label("0:00", skin); scoreText.setFontScale(FONT_SCALE, FONT_SCALE); pauseButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { model.togglePause(); } }); hudTable.top(); hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX() .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD); hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill() .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD); this.addActor(hudTable); }
/** * Adds the Achievements Button to the Networking Menu. * * @param table The table to where the Achievements button will be added. */ private void createAchievementButton(Table table) { TextButton achievementsButton = new TextButton("Achievements", skin1); achievementsButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { gameServices.showAchievements(); } }); table.add(achievementsButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row(); }
/** * Adds the Sign In / Sign Out Button to the Networking Menu. * * @param table The table to where the button will be added. */ private void createSignInBtn(Table table) { final TextButton signInButton = new TextButton( gameServices.isSignedIn() ? "Sign Out" : "Sign In!", skin1); signInButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (gameServices.isSignedIn()) { gameServices.signOut(); signInButton.setText("Sign In!"); } else { gameServices.signIn(); signInButton.setText("Sign Out"); } } }); table.add(signInButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row(); }
/** * {@inheritDoc} */ @Override protected TextButton addBackBtn(boolean style) { TextButton back = new TextButton("Back", (style ? skin2 : skin1)); back.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { game.setScreen(new NetworkingMenuScreen(game)); } }); return back; }
/** * Create a back button to return to the game scene */ private void initBackButton() { TextButtonSceneObject backButton; backButton = new TextButtonSceneObject(sceneData.createTextButton("Back", Assets.DICE_CHEATS_TEXT_BUTTON_DESCRIPTOR), null); backButton.setBounds(1000, 100, 500, 100); backButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (!canRoll) { writeRollResult(); // write roll result only now as we're done when we press back sceneData.sendMessageFromGui(new EvaluateDiceResultGui()); } } }); addSceneObject(backButton); }
private void initImageButtons() { if (!sceneData.isGameHost()) { return; // player is not hosting - don't offer the player to start the game. } imageButtonStartGame = new ImageButtonSceneObject(sceneData.createImageButton(Assets.START_GAME_BUTTON_FILENAME), buttonPressedSound); imageButtonStartGame.setBounds((Gdx.graphics.getWidth() / 2.0f) - 137.5f, Gdx.graphics.getHeight() / 10.0f, 275f, 240f); imageButtonStartGame.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { sceneData.sendMessageFromGui(new StartGameClicked()); } }); addSceneObject(imageButtonStartGame); imageButtonStartGame.setDisabled(); }
@Override public void displayScores(List<PlayerData> data) { table.clear(); table.row(); Label winner = new Label("Last penguin standing: " + data.get(0).displayName, uiSkin); table.add(winner).pad(10); for (int i = 0; i < data.size(); i++) { int rank = i + 1; PlayerData player = data.get(i); table.row(); String newBest = getBestText(player); Label l = new Label(rank + ". " + player.displayName + " " + data.get(i).totalScore + newBest, uiSkin); table.add(l).pad(5); } table.row(); table.add(menuButton).pad(30); menuButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { controller.onBack(); } }); table.addAction(Actions.fadeIn(1)); }
private void addChangeFaction(){ groupChangeFaction = new Group(); Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground))); background.setSize(Width - Width * 0.03f, Height * 0.1f); background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.3f); groupChangeFaction.addActor(background); Label labelFac = new Label("Change Faction",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE)); labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2); labelFac.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { manager.loadAssetsChoiceFaction(); gameManager.setScreen(new ScreenCircleLoading(gameManager,new ScreenChoiceFaction(gameManager),manager.getAssetsChoiceFaction())); } }); groupChangeFaction.addActor(labelFac); }
private void addTestCombat(){ groupTestCombat = new Group(); Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground))); background.setSize(Width - Width * 0.03f, Height * 0.1f); background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.15f); groupChangeFaction.addActor(background); Label labelFac = new Label("Combat Training",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE)); labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2); labelFac.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { manager.loadAssetsEnklaveScreen(); new GetEnklaveDetails().makeRequest(16066, manager); gameManager.screenEnklave.setEnklave3D(new Vector2(0,0)); gameManager.setScreen(new ScreenCircleLoading(gameManager,gameManager.screenEnklave,manager.getAssertEnklaveScreen()));; } }); groupChangeFaction.addActor(labelFac); }
private void drawtopcombat(){ groupTop = new Group(); Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular); lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); progressBarEnergy = ProgressBarEnergy.getInstance(); Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1))); imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f); imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f); imageLeftprofile.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1) gameManager.setScreen(gameManager.screenEnklave); else dialogExit("You can't out from combat!"); } }); groupTop.addActor(imageLeftprofile); }
private ButtonField<Item> createField(PacketsSender packetsSender, ItemPositionSupplier userInventoryTakeItemPositionSupplier) { ButtonField<Item> field = new ButtonField<Item>(); field.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (field.hasContent()) { Item item = field.getContent(); TakeItemFromContainerPacket packet = PacketsMaker.makeTakeItemFromContainerPacket( ContainerDialog.this.getId(), item.getId(), userInventoryTakeItemPositionSupplier.get(item)); packetsSender.send(packet); } } }); return field; }
@Override protected ButtonField<ItemQuickAccessIcon> createField(int cellPosition) { InventoryTextField<ItemQuickAccessIcon> inventoryField = new InventoryTextField<>( "F" + String.valueOf(cellPosition + 1)); inventoryField.setTextShiftX(-16); inventoryField.setTextShiftY(-4); inventoryField.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { fieldClicked(cellPosition); } }); return inventoryField; }
public AutoCleanupCloseButton(T dialogToClose, ActorManipulator linkedDialogs) { super(dialogToClose); this.dialogToClose = dialogToClose; this.linkedDialogs = linkedDialogs; this.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { cleanUpDialog(); onPress(); } }); }
private void createComponents() { btBackToMainMenu = new TextButton("Back to Main Menu", skin); btBackToMainMenu.center(); btBackToMainMenu.setWidth(600); btBackToMainMenu.setHeight(80); btBackToMainMenu.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { AL.getGame().setScreen(AL.getScreenManager().get(MainMenuScreen.class)); } }); btBackToMainMenu.setPosition(1920 / 2 - 300, 1080 / 2 + 40); stage.addActor(btBackToMainMenu); endgameLabel = new Label(endgameText, skin); endgameLabel.setWidth(600); endgameLabel.setHeight(80); endgameLabel.setAlignment(Align.center); endgameLabel.setPosition(1920 / 2 - 300, 1080 / 1.5f); stage.addActor(endgameLabel); }
private void initTabs() { // Init Tabs: btTabVideo = new TextButton("Video", skin); btTabVideo.setSize(300, 50); tabbedPane.addTab(btTabVideo); btTabAudio = new TextButton("Audio", skin); btTabAudio.setSize(300, 50); tabbedPane.addTab(btTabAudio); btTabInput = new TextButton("Input", skin); btTabInput.setSize(300, 50); btTabInput.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (!AL.getScreenManager().isRegistered(InputSettingsScreen.class)) AL.getScreenManager().register(new InputSettingsScreen(), InputSettingsScreen.class); AL.getGame().setScreen(AL.getScreenManager().get(InputSettingsScreen.class)); } }); tabbedPane.addTab(btTabInput); }
private void createBackButton() { btBack = new TextButton("Back", skin); btBack.setSize(300, 50); btBack.setPosition(1920 / 2 - 150, 1080 / 22); btBack.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (previousScreen != null) { AL.getGame().setScreen(previousScreen); } } }); stage.addActor(btBack); }
public GameButton(float WIDTH, float HEIGHT, String drawable, boolean isCheckable) { audioManager = AudioManager.getInstance(); skin = new Skin(); skin.addRegions(AssetsManager.getTextureAtlas()); Button.ButtonStyle buttonStyle = new Button.ButtonStyle(); buttonStyle.up = skin.getDrawable(drawable); buttonStyle.down = skin.getDrawable(drawable + "_pressed"); if (isCheckable) { buttonStyle.checked = skin.getDrawable(drawable + "_pressed"); } setStyle(buttonStyle); setSize(WIDTH, HEIGHT); rectangle = new Rectangle(getX(),getY(),getWidth(),getHeight()); addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); audioManager.playSound(audioManager.getButtonSound()); } }); }
private void createUI() { VerticalGroup screenContainer = new VerticalGroup(); screenContainer.setDebug(true); screenContainer.setFillParent(true); stage.addActor(screenContainer); TextButton btnAdd = new TextButton("Add...", skin); btnAdd.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { EditMiniHabitView dlg = new EditMiniHabitView("Add Mini-Habit", MainView.this.skin); dlg.addResultListener(MainView.this); dlg.show(MainView.this.stage); } }); miniHabitsView = new MiniHabitsView(skin, controller); screenContainer.addActor(miniHabitsView); screenContainer.addActor(btnAdd); }
private void createUI() { VerticalGroup screenContainer = new VerticalGroup(); screenContainer.setDebug(true); screenContainer.setFillParent(true); stage.addActor(screenContainer); TextButton btnAdd = new TextButton("Add...", skin); btnAdd.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { EditMiniHabitDialog dlg = new EditMiniHabitDialog("Add Mini-Habit", MainScreen.this.skin); dlg.addResultListener(MainScreen.this); dlg.show(MainScreen.this.stage); } }); screenContainer.addActor(new HabitsProgressListUI(skin, miniHabits)); screenContainer.addActor(btnAdd); }
public ObjectiveDialog(Skin skin, Hexpert hexpert) { super(hexpert, skin); getBackground().setMinWidth(1000); final TextButton textButtonOK = new TextButton(hexpert.i18NBundle.get("ok"), skin); textButtonOK.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { textButtonOK.setChecked(false); } }); setObject(textButtonOK, null); getButtonTable().add(textButtonOK); getContentTable().defaults().pad(5, 0, 5, 15); getContentTable().top(); }
public LockedDialog(int currentGoals, int goalsNeeded, Hexpert hexpert, Skin skin) { super(hexpert, skin.get("gray", WindowStyle.class)); getBackground().setMinWidth(1000); getBackground().setMinHeight(350); getContentTable().defaults().pad(25); TextButton.TextButtonStyle txtButtonStyle = skin.get("gray", TextButton.TextButtonStyle.class); Label label = new Label(hexpert.i18NBundle.format("locked_left", currentGoals, goalsNeeded), skin); getContentTable().add(label).top(); final TextButton textButtonOK = new TextButton(hexpert.i18NBundle.get("ok"), txtButtonStyle); textButtonOK.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { textButtonOK.setChecked(false); } }); setObject(textButtonOK, null); getButtonTable().add(textButtonOK); }
private void attachSoundListener() { addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { ButtonStyle style = getStyle(); if (style instanceof SavedGameButtonStyle) { SavedGameButtonStyle castStyle = (SavedGameButtonStyle) style; if (castStyle.clickSound != null) { castStyle.clickSound.play(Configuration.getUIEffectsVolume()); } } return false; } }); }
private void initResetButton() { resetButton = new Button(new Button.ButtonStyle()); resetButton.setWidth(40); resetButton.setHeight(20); resetButton.setX(160); resetButton.setY(550); resetButton.setDebug(true); stage.addActor(resetButton); resetButton.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { game.resetPoints(); return super.touchDown(event, x, y, pointer, button); } }); }
public OptionsScreen(Launcher launcher) { this.launcher = launcher; viewport = new FitViewport(1920, 1080); camera = new OrthographicCamera(); stage = new Stage(viewport, launcher.batch); skin = new Skin(Gdx.files.internal("gfx/skin/uiskin.json")); menu = new TextButton("MENU", skin, "default"); menu.setPosition(32, 48); menu.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { launcher.setScreen(new MenuScreen(launcher)); } }); stage.addActor(menu); Gdx.input.setInputProcessor(stage); }
protected ClickListener createListener() { return new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { final Actor actor = event.getListenerActor(); if (isLoading) { return; } isLoading = true; gameState.loadGame(((SavedGameButton) actor).getGame().getId(), new OkCancelCallback<GameMap>() { public void onOk(GameMap result) { callback.onOk(null); }; @Override public void onError(String errorMessage) { callback.onError(Strings.getString(UIManager.STRING_TABLE, "errorLoadingGame", ((SavedGameButton) actor).getGame().getName())); } }); isLoading = false; } }; }
public DeletableSavedGameButton(final SaveGameDetails game, final DeletableSavedGameButtonStyle style, final OkCancelCallback<Void> deleteConfirmationCallback) { super(game, style); deleteButton = new TextButtonWithSound(Strings.getString(UIManager.STRING_TABLE, "deleteSave"), style.deleteButtonStyle); deleteButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { event.stop(); UIManager.displayConfirmation( Strings.getString(UIManager.STRING_TABLE, "deleteSaveQuestion"), Strings.getString(UIManager.STRING_TABLE, "deleteSaveConfirmation", game.getName()), deleteConfirmationCallback); } }); add(deleteButton) .width(style.deleteButtonWidth) .height(style.deleteButtonHeight) .pad(style.deleteButtonMarginTop, style.deleteButtonMarginLeft, style.deleteButtonMarginBottom, style.deleteButtonMarginRight); }
private void attachSoundListener() { addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { if (isDisabled()) { return false; } ButtonStyle style = getStyle(); if (style instanceof TextButtonWithSoundStyle) { TextButtonWithSoundStyle castStyle = (TextButtonWithSoundStyle) style; if (castStyle.clickSound != null) { castStyle.clickSound.play(Configuration.getUIEffectsVolume()); } } return false; } }); }
@Override public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) { final ActorConsumer<?, Params> action = parser.parseAction(rawAttributeData, tmpParams); if (action == null) { parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor); } actor.addListener(new ClickListener(1) { @Override public void clicked(final InputEvent event, final float x, final float y) { tmpParams.actor = actor; tmpParams.x = x; tmpParams.y = y; tmpParams.stageX = event.getStageX(); tmpParams.stageY = event.getStageY(); action.consume(tmpParams); tmpParams.reset(); } }); }
public GameScreen(ShapeClearGame shapeClearGame) { game=shapeClearGame; stage=game.getStage(); startb=new ButtonActor(); startb.setNormalTexture(AssetLoader.gameStart); startb.setPressedTexture(AssetLoader.gameStartPressed); startb.text=Localize.get("test001"); startb.draggable=true; startb.addClickListener(new ClickListener(){ public void touchUp (InputEvent event, float x, float y, int pointer, int button) { doUpdate=!doUpdate; boardRenderer.flashing=!doUpdate; } }); }
protected Button getSettingsButton(boolean useText) { Button button = useText ? new BeepingImageTextButton("Settings", UIManager.skin, "settings") : new BeepingImageButton(UIManager.skin, "settings"); button.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ScreenManager.addScreen(new SettingsScreen()); } }); return button; }
public GamePauseMenuScreen(Level level, Screen gameScreen) { super(gameScreen, level); BeepingImageTextButton button = new BeepingImageTextButton("Resume", UIManager.skin, "play"); button.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ScreenManager.removeScreen(GamePauseMenuScreen.this); } }); this.centreCell .setActor(button); }
private TextButton getDebugDrawTextButton() { final TextButton debugDrawTextButton = new BeepingTextButton( "Debug draw", UIManager.skin, "checkable"); debugDrawTextButton.setChecked(SettingsManager.getDebugSettings().debugDraw); debugDrawTextButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); SettingsManager.getDebugSettings().debugDraw = !SettingsManager.getDebugSettings().debugDraw; debugDrawTextButton.setChecked(SettingsManager.getDebugSettings().debugDraw); } }); return debugDrawTextButton; }
private TextButton getNoGravityTextButton() { final TextButton infiniteFuelTextButton = new BeepingTextButton( "No gravity", UIManager.skin, "checkable"); infiniteFuelTextButton.setChecked(SettingsManager.getDebugSettings().noGravity); infiniteFuelTextButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); SettingsManager.getDebugSettings().noGravity = !SettingsManager.getDebugSettings().noGravity; infiniteFuelTextButton.setChecked(SettingsManager.getDebugSettings().noGravity); } }); return infiniteFuelTextButton; }
private TextButton getInfiniteFuelTextButton() { final TextButton infiniteFuelTextButton = new BeepingTextButton( "Infinite fuel", UIManager.skin, "checkable"); infiniteFuelTextButton.setChecked(SettingsManager.getDebugSettings().infiniteFuel); infiniteFuelTextButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); SettingsManager.getDebugSettings().infiniteFuel = !SettingsManager.getDebugSettings().infiniteFuel; infiniteFuelTextButton.setChecked(SettingsManager.getDebugSettings().infiniteFuel); } }); return infiniteFuelTextButton; }
public void init(String tilesetFile, int characterWidth, int characterHeight, int scale) { asciiTerminal = new AsciiTerminal(TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, tilesetFile, characterWidth, characterHeight, scale); for(int i = 0; i < 16; i++) { for(int j = 0; j < 10; j++) { asciiTerminal.write(i, j, (char)rand.nextInt(256), new Color(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1f)); } } AsciiTerminalButton button1 = new AsciiTerminalButton(asciiTerminal, "Click on me !", 0, 12, Color.FOREST, Color.ORANGE, Color.GREEN, Color.BLACK); button1.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { JOptionPane.showMessageDialog(null, "Thank !"); } }); asciiTerminal.addActor(button1); AsciiSelectableTerminalButton button2 = new AsciiSelectableTerminalButton(asciiTerminal, "Select me !", 0, 14, Color.FOREST, Color.ORANGE, Color.GREEN, Color.MAGENTA, Color.BLACK); asciiTerminal.addActor(button2); super.setScreen(asciiTerminal); }