Java 类com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup 实例源码
项目:MMORPG_Prototype
文件:ContainerDialog.java
private void addFieldRow(CharacterItemDataPacket[] itemsToShow, PacketsSender packetsSender, int numberOfItems,
int i, ItemPositionSupplier userInventoryTakeItemPositionSupplier)
{
HorizontalGroup buttonRow = new HorizontalGroup().space(0).pad(0).fill();
for (int j = 0; j < ROW_LENGTH; j++)
{
ButtonField<Item> field = createField(packetsSender, userInventoryTakeItemPositionSupplier);
int nextIndex = i * ROW_LENGTH + j;
buttonRow.addActor(field);
containerFields.put(new Point(j, i), field);
if (nextIndex < numberOfItems)
{
Item item = ItemFactory.produceItem(itemsToShow[nextIndex]);
field.put(item);
}
}
this.getContentTable().add(buttonRow);
}
项目:MMORPG_Prototype
文件:QuickAccessDialog.java
public QuickAccessDialog(String title)
{
super(title, Settings.DEFAULT_SKIN);
HorizontalGroup buttons = new HorizontalGroup().padBottom(8).space(4).padTop(0).fill();
for (int i = 0; i < 12; i++)
{
ButtonField<T> field = createField(i);
quickAccessButtons.put(i, field);
buttons.addActor(field);
}
add(buttons);
row();
pack();
this.setHeight(80);
this.setMovable(false);
}
项目:MMORPG_Prototype
文件:ShopPage.java
private void createUIElements()
{
space(0).pad(0).padRight(5).fill();
for (int i = 0; i < BUTTON_COLUMN_LENGTH; i++)
{
HorizontalGroup buttonRow = new HorizontalGroup().space(0).pad(0).fill();
for (int j = 0; j < BUTTON_ROW_LENGTH; j++)
{
Point cellPosition = new Point(j, i);
ButtonField<Item> field = new ButtonField<Item>();
inventoryFields.put(cellPosition, field);
buttonRow.addActor(field);
}
addActor(buttonRow);
}
padBottom(8);
}
项目:MMORPG_Prototype
文件:InventoryPage.java
public InventoryPage(InventoryDialog inventoryDialog, int pageIndex)
{
this.inventoryDialog = inventoryDialog;
space(0).pad(0).padRight(5).fill();
for (int i = 0; i < INVENTORY_FIELDS_HEIGHT_NUMBER; i++)
{
HorizontalGroup buttonRow = new HorizontalGroup().space(0).pad(0).fill();
for (int j = 0; j < INVENTORY_FIELDS_WIDTH_NUMBER; j++)
{
Point cellPosition = new Point(j, i);
ItemInventoryPosition inventoryPosition = new ItemInventoryPosition(pageIndex, cellPosition);
ButtonField<Item> button = createField(inventoryPosition);
inventoryFields.put(cellPosition, button);
buttonRow.addActor(button);
}
addActor(buttonRow);
}
padBottom(8);
}
项目:le-pendu
文件:KeyboardActor.java
public KeyboardActor(final PlayScreen playScreen) {
alphabet = new Texture("alphabet.png");
for (int i = 0 ; i < 26 ; i++) {
if (i%7 == 0) {
hg = new HorizontalGroup();
this.addActor(hg);
}
final char character = (char) (i + 65);
button = new ImageButton(new TextureRegionDrawable(new TextureRegion(alphabet, i * 90, 0, 90, 90)));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
playScreen.proposeLetter(character);
}
});
hg.addActor(button);
}
}
项目:gdx-lml
文件:CellPadTopLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value verticalValue = LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padTop(verticalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padTop(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padTop(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padTop(LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:gdx-lml
文件:CellPadLeftLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value horizontalValue = LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padLeft(horizontalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padLeft(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padLeft(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padLeft(LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:gdx-lml
文件:CellPadRightLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value horizontalValue = LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padRight(horizontalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padRight(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padRight(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padRight(LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:gdx-lml
文件:CellAlignLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Applied if not in a cell.
if (actor instanceof Label) {
((Label) actor).setAlignment(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else if (actor instanceof Table) {
((Table) actor).align(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else if (actor instanceof Image) {
((Image) actor).setAlign(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).align(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).align(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else if (actor instanceof TextField) {
((TextField) actor).setAlignment(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:gdx-lml
文件:CellPadBottomLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value verticalValue = LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padBottom(verticalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padBottom(LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:HAW-SE2-projecthorse
文件:NavBar.java
/**
* Konstruktor.
*/
public NavBar() {
if (GameManagerFactory.getInstance().getPlatform().getOrientation() == Orientation.Landscape) {
NAVBAR_HIGH = (int) (this.height * 0.25);
NAVBAR_WITH = (int) (this.width);
} else {
NAVBAR_HIGH = (int) (this.height * 0.14);
NAVBAR_WITH = (int) (this.width);
}
horizontalGroup = new HorizontalGroup();
horizontalGroup.reverse();
horizontalGroup.space((float) (this.width * 0.005));
horizontalGroup.setHeight(NAVBAR_HIGH);
horizontalGroup.setWidth(NAVBAR_WITH);
setToTop();
this.addActor(horizontalGroup);
this.pack();
}
项目:GdxStudio
文件:Serializer.java
public static void setup(){
registerSerializer(Actor.class, new ActorSerializer());
registerSerializer(Scene.class, new SceneSerializer());
registerSerializer(ImageJson.class, new ImageJson());
registerSerializer(Label.class, new LabelSerializer());
registerSerializer(Button.class, new ButtonSerializer());
registerSerializer(TextButton.class, new TextButtonSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(CheckBox.class, new CheckBoxSerializer());
registerSerializer(SelectBox.class, new SelectBoxSerializer());
registerSerializer(List.class, new ListSerializer());
registerSerializer(Slider.class, new SliderSerializer());
registerSerializer(TextField.class, new TextFieldSerializer());
registerSerializer(Touchpad.class, new TouchpadSerializer());
registerSerializer(Sprite.class, new SpriteSerializer());
registerSerializer(Dialog.class, new DialogSerializer());
registerSerializer(SplitPane.class, new SplitPaneSerializer());
registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
registerSerializer(Stack.class, new StackSerializer());
registerSerializer(Tree.class, new TreeSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
项目:bladecoder-adventure-engine
文件:TabPanel.java
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();
}
项目:bladecoder-adventure-engine
文件:ScopePanel.java
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);
}
项目:craft
文件:RecipeWidget.java
private Actor generateTop(Item item) {
HorizontalGroup group = new HorizontalGroup();
group.align(Align.left);
IconWidget icon = new IconWidget(item, 0);
icon.setHandle(icon.new DefaultIconHandle() {
@Override
public boolean isDraggable(int amount) {
return false;
}
@Override
public boolean isVisible(int currentAmount) {
return false;
}
});
group.addActor(icon);
HorizontalGroup wrapper = new HorizontalGroup();
Label caption = new Label(Bundles.items.get(item.getId().toString()), Styles.LBL_ITEM);
caption.setColor(item.getRarity().getColor());
icon.setWidth(caption.getHeight() * 4);
icon.setHeight(caption.getHeight() * 4);
wrapper.addActor(caption);
wrapper.padLeft(15f);
group.addActor(wrapper);
return group;
}
项目:Cardshifter
文件:CardViewBig.java
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();
}
项目:gdx-lml
文件:CellSpaceLmlAttribute.java
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).space(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).space(parser.parseFloat(rawAttributeData, actor));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
项目:Missing_Words
文件:LanguageSelectionScreen.java
public LanguageSelectionScreen(MissingWords missingWords) {
super(missingWords);
/* Creamos el fondo de pantalla */
background = new Background(MissingWords.myManager.get("background.png", Texture.class));
stage.addActor(background);
/* Creamos los botones con los idiomas */
buttonGerman = new ImageButton(new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("Germany-flag.png", Texture.class))));
buttonGerman.addListener(new MenuListener(missingWords, "german"));
buttonEnglish = new ImageButton(new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("United-kingdom-flag.png", Texture.class))));
buttonEnglish.addListener(new MenuListener(missingWords, "english"));
/* Creamos el grupo que almacena los botones */
languageBox = new HorizontalGroup();
languageBox.space(100); // Espacio entre botones
/* A�adimos los botones al grupo */
languageBox.addActor(buttonGerman);
languageBox.addActor(buttonEnglish);
/* Posicionamos el grupo en el centro de la pantalla */
languageBox.setPosition((MissingWords.VIEWPORT_WIDTH - languageBox.getMinWidth()) / 2,
(MissingWords.VIEWPORT_HEIGHT - languageBox.getMaxHeight()) / 2);
stage.addActor(languageBox); // A�adimos el grupo al escenario
}
项目:Cardshifter
文件:DefaultZoneView.java
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)));
}
}
项目:Cardshifter
文件:ResourceView.java
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());
}
}
项目:nikkylittlequest
文件:Table2D.java
/**
* @return number of actors in the table.
*/
public Integer countElements() {
int count = 0;
HorizontalGroup group;
for (int i = 0; i < this.getRowCount(); i++) {
group = this.getGroupInRow(i);
count += group.getChildren().size;
}
return count;
}
项目:nikkylittlequest
文件:Table2D.java
/**
* Removes all combat objects in table, but doe snot remove
* the horizontal groups in the vertical groups.
*/
public void clearObjects() {
HorizontalGroup group;
for(int i = 0; i < this.getChildren().size; i++) {
group = this.getGroupInRow(i);
group.clearChildren();
}
}
项目:nikkylittlequest
文件:TestTable2D.java
@Test
public void testScturctureIs3InARow() {
Table2D table = new Table2D(3);
//System.out.println("testScturctureIs3InARow");
table.add(objectA);
table.add(objectB);
table.add(objectC);
HorizontalGroup groups = (HorizontalGroup)table.getChildren().get(0);
assertThat(groups.getChildren().size, is(3));
}
项目:OdysseeDesMaths
文件:DialogScreen.java
public DialogScreen(OdysseeDesMaths game, EndButtonsListener endButtonsListener) {
this.game = game;
this.endButtonsListener = endButtonsListener;
viewport = new StretchViewport(WIDTH, HEIGHT);
stage = new Stage(viewport);
Gdx.input.setInputProcessor(stage);
skin = new Skin();
skin.addRegions(Assets.getManager().get(Assets.UI_SCROLL, TextureAtlas.class));
skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
mainTable = new Table();
mainTable.setFillParent(true);
stage.addActor(mainTable);
leftCharGroup = new HorizontalGroup();
rightCharGroup = new HorizontalGroup();
leftCharGroup.space(5);
rightCharGroup.space(5);
charsImages = new Image[MAX_CHARS];
for (int i=0; i<MAX_CHARS; i++) {
charsImages[i] = new Image();
if (i < MAX_CHARS/2) {
leftCharGroup.addActor(charsImages[i]);
} else {
rightCharGroup.addActor(charsImages[i]);
}
}
middleImage = new Image();
dialogTable = new Table();
dialogTable.background(skin.getDrawable("scroll_background"));
buttonsGroup = new HorizontalGroup();
buttonsGroup.space(10);
buttonStyle = new TextButton.TextButtonStyle();
buttonStyle.up = skin.getDrawable("button");
buttonStyle.down = skin.getDrawable("button_pressed");
buttonStyle.font = FONT_12;
buttonStyle.fontColor = Color.WHITE;
buildGUI();
displayAction = new DisplayTextAction();
endButtonsList = new ArrayList<>();
//stage.setDebugAll(true);
}
项目:gdx-lml
文件:HorizontalGroupReverseLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupReverseLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.reverse(parser.parseBoolean(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupPaddingLeftLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupPaddingLeftLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.padLeft(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupSpacingLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupSpacingLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.space(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupPaddingBottomLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupPaddingBottomLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.padBottom(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupFillLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupFillLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.fill(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupPaddingTopLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupPaddingTopLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.padTop(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupPaddingLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupPaddingLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.pad(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml
文件:HorizontalGroupAlignmentLmlAttribute.java
@Override
public Class<HorizontalGroup> getHandledType() {
return HorizontalGroup.class;
}
项目:gdx-lml
文件:HorizontalGroupAlignmentLmlAttribute.java
@Override
public void process(final LmlParser parser, final LmlTag tag, final HorizontalGroup actor,
final String rawAttributeData) {
actor.align(LmlUtilities.parseAlignment(parser, actor, rawAttributeData));
}