List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane
public ScrollPane(Actor widget)
From source file:net.noviden.towerdefense.Screens.MapSelectorScreen.java
License:Open Source License
public MapSelectorScreen(final TowerDefense towerDefense) { this.towerDefense = towerDefense; Skin skin = new Skin(Gdx.files.internal("assets/uiskin.json")); stage = new Stage(); rootTable = new Table(); rootTable.setFillParent(true);/* w w w . j a v a2 s.c o m*/ Table containerTable = new Table(); Table mapListTable = new Table(); for (int i = 0; i < towerDefense.maps.size(); i++) { if (i > 0 && i % 3 == 0) { mapListTable.row(); } final Map map = towerDefense.maps.get(i); ClickListener clickListener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { towerDefense.setScreen(new net.noviden.towerdefense.Screens.GameScreen(towerDefense, map)); } }; TextButton textButton = new TextButton(map.getName(), skin); textButton.addListener(clickListener); ImageButton imageButton = new ImageButton(MapThumbnail.createThumbnail(map, 200)); imageButton.addListener(clickListener); mapListTable.add(imageButton).pad(10.0f); } ScrollPane scrollPane = new ScrollPane(mapListTable); scrollPane.layout(); scrollPane.setFadeScrollBars(false); TextButton exitButton = new TextButton("Main Menu", skin); exitButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { towerDefense.setScreen(new MainMenuScreen(towerDefense)); } }); containerTable.add(scrollPane).fillX().fillY(); rootTable.add(containerTable).expandY().pad(10.0f); rootTable.row(); rootTable.add(exitButton).bottom().expandX().right().pad(8.0f); stage.addActor(rootTable); Gdx.input.setInputProcessor(stage); }
From source file:org.anism.lotw.LOTW.java
License:Open Source License
public Table putSettingsMenu(Stage src) { Table outTable = new Table(); outTable.setSize(buttonWidth, G.height - 96 * dpi); outTable.setPosition(0, 96 * dpi);//from w w w .j av a 2s .c o m outTable.left().top(); outTable.defaults().width(buttonWidth + 8 * dpi).height(settingsButtonHeight); Label setLabel = new Label("Settings", labelStyle); outTable.add(setLabel).width(setLabel.getWidth()).center(); outTable.row(); Table inTable = new Table(); inTable.defaults().pad(4 * dpi).width(buttonWidth).height(settingsButtonHeight); inTable.add(addButton(null, controlSettings, "Controls", 0, 0, 0, 0)); inTable.row(); inTable.add(addButton(null, colorSettings, "Display", 0, 0, 0, 0)); inTable.row(); inTable.add(addButton(null, modeSettings, "Mode", 0, 0, 0, 0)); inTable.row(); inTable.add(addButton(null, loginSettings, "Online", 0, 0, 0, 0)); inTable.row(); inTable.add(addButton(null, bottomSettings, "Advanced", 0, 0, 0, 0)); ScrollPane pane = new ScrollPane(inTable); outTable.add(pane).height(G.height - settingsButtonHeight - 96 * dpi); if (src != null) { src.addActor(outTable); } return outTable; }
From source file:se.danielj.geometridestroyer.LevelScreen.java
License:GNU General Public License
public LevelScreen(final Core core, InputMultiplexer inputMultiplexer) { this.core = core; stage = new Stage(); stage.setViewport(Constants.STAGE_WIDTH, Constants.STAGE_HEIGHT, false); camera = new OrthographicCamera(Constants.WIDTH, Constants.HEIGHT); camera.position.set(Constants.WIDTH / 2, Constants.HEIGHT / 2, 0); camera.update();/* w w w .ja va 2 s . co m*/ batch = new SpriteBatch(); inputMultiplexer.addProcessor(stage); inputMultiplexer.addProcessor(this); Table table = new Table(); for (int i = 1; i <= GeometriDestroyer.numberOfLevels; ++i) { table.row(); table.add(new LevelButton(i)).height(80); } ScrollPane scrollPane = new ScrollPane(table); scrollPane.setPosition(0, 50); scrollPane.setSize(600, 620); scrollPane.setFadeScrollBars(false); ScrollPaneStyle scrollPaneStyle = new ScrollPaneStyle(); scrollPaneStyle.vScrollKnob = new TextureRegionDrawable( SpriteManager.getSprite(SpriteManager.Sprites.SCROLL)); scrollPaneStyle.vScroll = new TextureRegionDrawable( SpriteManager.getSprite(SpriteManager.Sprites.SCROLL_BG)); scrollPane.setStyle(scrollPaneStyle); stage.addActor(scrollPane); LabelStyle style = new LabelStyle(); style.font = FontManager.getTitleFont(); style.fontColor = new Color(1, 1, 1, 1); Label title = new Label("Geometri\nDestroyer", style); title.setPosition(650, 400); stage.addActor(title); final TextButtonStyle textButtonStyle = new TextButtonStyle(); textButtonStyle.font = FontManager.getNormalFont(); textButtonStyle.up = new TextureRegionDrawable(SpriteManager.getSprite(SpriteManager.Sprites.BLANK)); textButtonStyle.down = new TextureRegionDrawable(SpriteManager.getSprite(SpriteManager.Sprites.BLANK)); textButtonStyle.fontColor = new Color(0.9f, 0.5f, 0.5f, 1); textButtonStyle.downFontColor = new Color(0, 0.4f, 0, 1); TextButton button = new TextButton("Credits", textButtonStyle); button.setPosition(700, 100); button.addListener(new InputListener() { private boolean pressed = false; @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { pressed = true; return true; } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (pressed) { LevelScreen.this.core.setScreen(core.credits); } } @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { pressed = ((TextButton) event.getListenerActor()).isPressed(); } }); stage.addActor(button); }
From source file:sink.core.Sink.java
License:Apache License
public LogPane(Skin skin) { setSize(300, 100);//from w ww .java2s. c om logLabel = new Label("", skin); scroll = new ScrollPane(logLabel); scroll.setPosition(0, 0); scroll.setSize(300, 100); scroll.setBounds(0, 0, 300, 100); addActor(scroll); }
From source file:sink.core.Sink.java
License:Apache License
public LogPane(BitmapFont font) { setSize(300, 100);//from w ww.j a v a2 s . c om LabelStyle ls = new LabelStyle(); ls.font = font; logLabel = new Label("", ls); scroll = new ScrollPane(logLabel); scroll.setPosition(0, 0); scroll.setSize(300, 100); scroll.setBounds(0, 0, 300, 100); addActor(scroll); }
From source file:ui.PracticeScrollPanel.java
License:Apache License
public PracticeScrollPanel(final PracticeScreen screen, Rectangle bounds) { this.screen = screen; Table table = new Table(); int i = 0;/*w ww.java 2 s . c o m*/ while (i < NUM_GAMETYPES) { table.row().expandX().pad(40); for (int j = 0; j < NUM_COLUMNS; j++) { final GameType type = GameType.values()[i % GameType.values().length]; final String name = GameNames[type.ordinal()]; final Image img = new Image(HyperTask.res.getTexture(name)); img.setSize(78, 78); img.setColor(GameColors[type.ordinal()]); img.setOrigin(Align.center); //img.setScale(1.2f); img.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { AudioManager.instance().play(HyperTask.res.getSound(SOUND_CLICK), CLICK_VOLUME); img.addAction( Actions.sequence(Actions.scaleTo(1.8f, 1.8f, 0.1f), Actions.scaleTo(1, 1, 0.1f))); screen.setGame(type); } }); table.add(img); i++; if (i >= NUM_GAMETYPES) break; } } final ScrollPane scroll = new ScrollPane(table); scroll.setOverscroll(false, true); scroll.setScrollingDisabled(true, false); setBounds(bounds.x, bounds.y, bounds.width, bounds.height); add(scroll).expand().fill(); }