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

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup. 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: CardViewBig.java    From Cardshifter with Apache License 2.0 6 votes vote down vote up
public CardViewBig(CardshifterGame game, CardInfoMessage cardInfo) {
    this.properties = new HashMap<String, Object>(cardInfo.getProperties());
    this.id = cardInfo.getId();
    table = new Table(game.skin);
    table.add((String) cardInfo.getProperties().get("name"));
    costs = new HorizontalGroup();
    costs.addActor(new Label("A", game.skin));
    table.add(costs).row();
    // table.add(image);
    Table textTable = new Table(game.skin);
    textTable.add("Abilities").row();
    textTable.add("Effect").row();
    textTable.add("Flavortext").bottom();
    table.add(textTable).colspan(2).row();
    table.add("Type").left();

    gives = new HorizontalGroup();
    gives.addActor(new Label("ABC", game.skin));
    table.add(gives).right();
}
 
Example #2
Source File: ScopePanel.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public ScopePanel(Skin skin) {
	super(skin);
	this.skin = skin;
	buttonGroup = new ButtonGroup<TextButton>();
	hPanel = new HorizontalGroup();
	hPanel.wrap(true);
	hPanel.rowAlign(Align.left);
	
	buttonGroup.setMaxCheckCount(1);
	buttonGroup.setMinCheckCount(1);
	buttonGroup.setUncheckLast(true);
	
	hPanel.addActor(new Label("Scope: ", skin));
	
	addButton(WORLD_SCOPE);
	addButton(SCENE_SCOPE);
	addButton(ACTOR_SCOPE);
	
	add(hPanel).expandX().fillX().center();
	
	buttonGroup.getButtons().get(2).setChecked(true);
}
 
Example #3
Source File: TabPanel.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public TabPanel(Skin skin) {
	super(skin);
	this.skin = skin;
	buttonGroup = new ButtonGroup<Button>();
	header = new HorizontalGroup();
	body = new Container<Actor>();
	tabs = new ArrayList<Tab>();
	
	buttonGroup.setMaxCheckCount(1);
	buttonGroup.setMinCheckCount(1);
	buttonGroup.setUncheckLast(true);
	
	header.wrap(true);
	header.rowAlign(Align.left);
	
	add(header).expandX().fillX().left();
	row();
	add(body).expand().fill();

	body.fill();
}
 
Example #4
Source File: HorizontalGroupGrowLmlAttribute.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, HorizontalGroup 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 #5
Source File: ResourceView.java    From Cardshifter with Apache License 2.0 5 votes vote down vote up
public ResourceView(Skin skin, List<ResView> views) {
    this.actor = new HorizontalGroup();
    this.skin = skin;
    this.views = new ArrayList<ResView>(views);
    for (ResView view : views) {
        this.actor.addActor(view.getActor());
    }
}
 
Example #6
Source File: DefaultZoneView.java    From Cardshifter with Apache License 2.0 5 votes vote down vote up
public DefaultZoneView(CardshifterClientContext context, ZoneMessage message, Map<Integer, EntityView> viewMap) {
    super(message);
    this.group = new HorizontalGroup();
    this.group.space(5);
    this.group.fill();
    this.context = context;
    for (int id : message.getEntities()) {
        viewMap.put(id, addCard(new CardInfoMessage(message.getId(), id, null)));
    }
}
 
Example #7
Source File: PortraitsUI.java    From Norii with Apache License 2.0 5 votes vote down vote up
private void initializeVariables(Entity[] entities) {
	portraits = new ArrayList<PortraitUI>();
	stacks = new ArrayList<Stack>();
	hgroup = new HorizontalGroup();
	tileWidthPixel = Gdx.graphics.getWidth() / (float) TILE_TO_PIXEL_RATIO;
	tileHeightPixel = Gdx.graphics.getHeight() / (float) TILE_TO_PIXEL_RATIO;

	configureWindow();
	setFadeEffectBackground();
	configureHorizontalGroup();
	createPortraits(entities);
	updatePositionContainer();
}
 
Example #8
Source File: MenuScreen.java    From Cardshifter with Apache License 2.0 4 votes vote down vote up
public MenuScreen(final CardshifterGame game) {
    final Preferences prefs = Gdx.app.getPreferences("cardshifter");
    this.table = new Table();
    this.game = game;
    this.table.setFillParent(true);
    
    Image imageObject = new Image(new Texture(Gdx.files.internal("bg2.png")));
    this.table.add(imageObject);
    this.table.row();

    Table inner = new Table();

    final TextField username = new TextField("", game.skin);
    String[] servers = isGWT() ? availableWSServers : availableServers;
    inner.add(username).expand().fill().colspan(servers.length).row();
    username.setText(prefs.getString("username", "YourUserName"));

    HorizontalGroup serverView = new HorizontalGroup();
    for (final String server : servers) {
        final String[] serverData = server.split(":");
        TextButton button = new TextButton(serverData[0], game.skin);
        button.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                prefs.putString("username", username.getText());
                prefs.flush();
                String hostname = isGWT() ? "ws://" + serverData[0] : serverData[0];
                try {
                    ClientScreen clientScreen = new ClientScreen(game, hostname, Integer.parseInt(serverData[1]), username.getText());
                    game.setScreen(clientScreen);
                } catch (GdxRuntimeException e) {
                	MenuScreen.this.connectionLabel.setText("Connection Failed!");
                }
            }
        });
        serverView.addActor(button);
    }
    inner.add(serverView).expand().fill();
    table.add(inner);
    table.row();
    
    this.connectionLabel = new Label(" ", game.skin);
    this.table.add(this.connectionLabel);
    
}
 
Example #9
Source File: HorizontalGroupGrowLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<HorizontalGroup> getHandledType() {
    return HorizontalGroup.class;
}
 
Example #10
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 #11
Source File: BottomMenu.java    From Norii with Apache License 2.0 4 votes vote down vote up
private void initBottomMenuTable() {
	bottomMenuTable = new HorizontalGroup();
	bottomMenuTable.setFillParent(true);
	bottomMenuTable.pad(0);
}
 
Example #12
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 #13
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 #14
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 #15
Source File: HorizontalGroupExpandLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, HorizontalGroup actor, String rawAttributeData) {
    actor.expand(parser.parseBoolean(rawAttributeData));
}
 
Example #16
Source File: HorizontalGroupExpandLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<HorizontalGroup> getHandledType() {
    return HorizontalGroup.class;
}
 
Example #17
Source File: HorizontalGroupWrapLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, HorizontalGroup actor, String rawAttributeData) {
    actor.wrap(parser.parseBoolean(rawAttributeData));
}
 
Example #18
Source File: HorizontalGroupWrapLmlAttribute.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
@Override
public Class<HorizontalGroup> getHandledType() {
    return HorizontalGroup.class;
}
 
Example #19
Source File: DragPane.java    From vis-ui with Apache License 2.0 2 votes vote down vote up
/**
 * @return true if children are displayed horizontally in a {@link HorizontalGroup}.
 * @see #getHorizontalGroup()
 */
public boolean isHorizontal () {
	return getActor() instanceof HorizontalGroup;
}
 
Example #20
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 horizontal.
 * @see #isHorizontal()
 */
public HorizontalGroup getHorizontalGroup () {
	return (HorizontalGroup) getActor();
}