com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup. 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: VerticalGroupGrowLmlAttribute.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
    boolean grow = parser.parseBoolean(rawAttributeData);
    if (grow) {
        actor.expand(true);
        actor.fill(1.0f);
    } else {
        actor.expand(false);
        actor.fill(0.0f);
    }
}
 
Example #2
Source File: VerticalGroupWrapLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<VerticalGroup> getHandledType() {
    return VerticalGroup.class;
}
 
Example #3
Source File: VerticalGroupWrapLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
    actor.wrap(parser.parseBoolean(rawAttributeData));
}
 
Example #4
Source File: VerticalGroupGrowLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<VerticalGroup> getHandledType() {
    return VerticalGroup.class;
}
 
Example #5
Source File: VerticalGroupExpandLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<VerticalGroup> getHandledType() {
    return VerticalGroup.class;
}
 
Example #6
Source File: VerticalGroupExpandLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
    actor.expand(parser.parseBoolean(rawAttributeData));
}
 
Example #7
Source File: HudRenderer.java    From xibalba with MIT License 4 votes vote down vote up
/**
 * Renders the HUD.
 *
 * @param main  Instance of Main class
 * @param batch The sprite batch to use (set in PlayScreen)
 */
public HudRenderer(Main main, SpriteBatch batch) {
  this.main = main;

  viewport = new FitViewport(960, 540, new OrthographicCamera());
  stage = new Stage(viewport, batch);

  player = WorldManager.player;
  playerDetails = ComponentMappers.player.get(player);
  playerAttributes = ComponentMappers.attributes.get(player);
  playerPosition = ComponentMappers.position.get(player);
  god = ComponentMappers.god.get(WorldManager.god);

  Table topTable = new Table();
  topTable.top().left();
  topTable.setFillParent(true);
  stage.addActor(topTable);

  playerInfo = new VerticalGroup().top().left().columnLeft();
  enemyInfo = new VerticalGroup().top().center().columnCenter();
  gameInfo = new VerticalGroup().top().right().columnRight();

  int width = Gdx.graphics.getWidth() / 3 - 20;

  topTable.add(playerInfo).pad(10, 10, 10, 10).width(width).top();
  topTable.add(enemyInfo).pad(10, 10, 10, 10).width(width).top();
  topTable.add(gameInfo).pad(10, 10, 10, 10).width(width).top();

  bottomTable = new Table();
  bottomTable.bottom().left();
  bottomTable.setFillParent(true);
  stage.addActor(bottomTable);

  actionLog = new VerticalGroup().top().left().columnLeft();
  focusedTable = new Table().top().center();
  buttonsAndAreaDetails = new VerticalGroup().top().right().columnRight();

  areaDetails = new VerticalGroup().top().right().columnRight().pad(0, 0, 5, 0);
  buttonsAndAreaDetails.addActor(areaDetails);

  menuButtons = new Table().right();
  setupMenuButtons();

  bottomTable.add(actionLog).pad(10, 10, 10, 10).width(width).bottom();
  bottomTable.add(focusedTable).pad(10, 10, 10, 10).width(width).top();
  bottomTable.add(buttonsAndAreaDetails).pad(10, 10, 10, 10).width(width).bottom();

  setupDeathDialog();

  stage.setKeyboardFocus(bottomTable);
}
 
Example #8
Source File: HelpScreen.java    From xibalba with MIT License 4 votes vote down vote up
/**
 * Help screen.
 *
 * @param main Instance of Main
 */
public HelpScreen(Main main) {
  stage = new Stage(new FitViewport(960, 540));

  Table table = new Table();
  table.setFillParent(true);
  table.left().top();
  stage.addActor(table);

  Table titleTable = new Table();

  HorizontalGroup titleGroup = new HorizontalGroup();
  titleGroup.space(10);
  titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);

  ActionButton closeButton = new ActionButton("Q", null);
  closeButton.setKeys(Input.Keys.Q);
  closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
  titleGroup.addActor(closeButton);

  Label title = new Label("Help", Main.skin);
  titleGroup.addActor(title);

  VerticalGroup group = new VerticalGroup().top().left().columnLeft();

  Table helpTable = new Table();
  helpTable.add(group).pad(10).top().left();

  group.addActor(new Label("[DARK_GRAY]Movement & melee attacks:[] numpad keys", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Shoot range weapon:[] r", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Focused attack:[] shift + attack key", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Look at a tile you're not on:[] s", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Throw:[] t", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Confirm action:[] space", Main.skin));
  group.addActor(new Label("[DARK_GRAY]Close dialogs or cancel actions:[] q", Main.skin));

  table.add(titleTable);
  table.row();
  table.add(helpTable).left();

  Gdx.input.setInputProcessor(stage);
  stage.setKeyboardFocus(table);
}
 
Example #9
Source File: AbilitiesScreen.java    From xibalba with MIT License 4 votes vote down vote up
/**
 * View and use your abilities.
 *
 * @param main Instance of Main
 */
public AbilitiesScreen(Main main) {
  this.main = main;

  abilities = ComponentMappers.abilities.get(WorldManager.player).abilities;
  playerDetails = ComponentMappers.player.get(WorldManager.player);

  stage = new Stage(new FitViewport(960, 540));

  table = new Table();
  table.setFillParent(true);
  table.left().top();
  stage.addActor(table);

  Table titleTable = new Table();

  HorizontalGroup titleGroup = new HorizontalGroup();
  titleGroup.space(10);
  titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);

  ActionButton closeButton = new ActionButton("Q", null);
  closeButton.setKeys(Input.Keys.Q);
  closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
  titleGroup.addActor(closeButton);

  Label title = new Label("Abilities", Main.skin);
  titleGroup.addActor(title);

  abilitiesGroup = new VerticalGroup().top().left().columnLeft();

  Table abilitiesTable = new Table();
  abilitiesTable.add(abilitiesGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2);

  table.add(titleTable);
  table.row();
  table.add(abilitiesTable).left();

  setupAbilities();

  Gdx.input.setInputProcessor(stage);
  stage.setKeyboardFocus(table);
}
 
Example #10
Source File: CraftScreen.java    From xibalba with MIT License 4 votes vote down vote up
/**
 * Craft screen.
 *
 * @param main Instance of Main
 */
public CraftScreen(Main main) {
  stage = new Stage(new FitViewport(960, 540));

  Constructor constructor = new Constructor(ItemData.class);
  constructor.addTypeDescription(new TypeDescription(Bleed.class, "!Bleed"));
  constructor.addTypeDescription(new TypeDescription(Charm.class, "!Charm"));
  constructor.addTypeDescription(new TypeDescription(DealDamage.class, "!DealDamage"));
  constructor.addTypeDescription(new TypeDescription(Poison.class, "!Poison"));
  constructor.addTypeDescription(new TypeDescription(RaiseHealth.class, "!RaiseHealth"));
  constructor.addTypeDescription(new TypeDescription(StartFire.class, "!StartFire"));
  TypeDescription itemDescription = new TypeDescription(ItemData.class);
  itemDescription.putListPropertyType("requiredComponent", ItemRequiredComponentData.class);
  constructor.addTypeDescription(itemDescription);
  Yaml yaml = new Yaml(constructor);
  recipes = new HashMap<>();

  for (Map.Entry<String, String> entry : Main.itemsData.entrySet()) {
    ItemData data = (ItemData) yaml.load(entry.getValue());

    if (data.requiredComponents != null) {
      recipes.put(entry.getKey(), data);
    }
  }

  table = new Table();
  table.setFillParent(true);
  table.left().top();
  stage.addActor(table);

  Table titleTable = new Table();

  HorizontalGroup titleGroup = new HorizontalGroup();
  titleGroup.space(10);
  titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);

  ActionButton closeButton = new ActionButton("Q", null);
  closeButton.setKeys(Input.Keys.Q);
  closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
  titleGroup.addActor(closeButton);

  Label title = new Label("Craft", Main.skin);
  titleGroup.addActor(title);

  recipeGroup = new VerticalGroup().top().left().columnLeft();

  Table craftTable = new Table();
  craftTable.add(recipeGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2);

  table.add(titleTable);
  table.row();
  table.add(craftTable).left();

  setupRecipes();

  Gdx.input.setInputProcessor(stage);
  stage.setKeyboardFocus(table);
}
 
Example #11
Source File: DragPane.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** @param vertical if true, actors will be stored vertically, if false - horizontally. */
public DragPane (final boolean vertical) {
	this(vertical ? new VerticalGroup() : new HorizontalGroup());
}
 
Example #12
Source File: DragPane.java    From vis-ui with Apache License 2.0 2 votes vote down vote up
/**
 * @return true if children are displayed vertically in a {@link VerticalGroup}.
 * @see #getVerticalGroup()
 */
public boolean isVertical () {
	return getActor() instanceof VerticalGroup;
}
 
Example #13
Source File: DragPane.java    From vis-ui with Apache License 2.0 2 votes vote down vote up
/**
 * @return internally managed group of actors.
 * @throws ClassCastException if drag pane is not vertical.
 * @see #isVertical()
 */
public VerticalGroup getVerticalGroup () {
	return (VerticalGroup) getActor();
}