当前位置: 首页>>代码示例>>Java>>正文


Java Table.add方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.add方法的典型用法代码示例。如果您正苦于以下问题:Java Table.add方法的具体用法?Java Table.add怎么用?Java Table.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.Table的用法示例。


在下文中一共展示了Table.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
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;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例2: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
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;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例3: createSkins

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:31,代码来源:CustomizeMenuScreen.java

示例4: AddWindowButton

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
	final TextButton btn = new TextButton(buttonText, skin);

	btn.addListener(new ChangeListener()
	{
		@Override
		public void changed(ChangeEvent event, Actor actor)
		{
			if (window.isShowing())
				window.hide();
			else
				window.show();
		}
	});

	table.add(btn);
	table.row();
}
 
开发者ID:bp2008,项目名称:blueirisviewer,代码行数:20,代码来源:MainOptionsWnd.java

示例5: PauseWindow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public PauseWindow(String title, Skin skin) {
	super(title, skin);
       this.setVisible(false);
       primaryMenu = new Table(skin);
       settingsPanel = new SettingsPanel(skin);
       _okButton  = new TextButton("OK" , skin , "menu");
       settingsPanel.add(_okButton);
       _resumeButton = new TextButton("Resume",Assets._skin , "menu");
       _mainMenuButton = new TextButton("Main Menu",Assets._skin , "menu");
       _settingsButton = new TextButton("Settings",Assets._skin , "menu");
       
       primaryMenu.add(_resumeButton).padBottom(20f).row();
       primaryMenu.add(_settingsButton).padBottom(20f).row();
       primaryMenu.add(_mainMenuButton);
       this.add(primaryMenu).align(Align.center).fill();
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:17,代码来源:PauseWindow.java

示例6: ScrollInventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
  defaults().space(4f);

  add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
  row();

  inner = new Table();
  inner.defaults().space(4f);
  for (int i = 0; i < inventory.itemStacks.length; i++) {
    SlotActor slotActor = new SlotActor(inventory, i);
    inner.add(slotActor);

    if ((i + 1) % inventory.width == 0) {
      inner.row();
    }
  }
  inner.pack();

  scrollPane = new ScrollPane(inner);
  scrollPane.setScrollingDisabled(true, false);
  add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
  row();
  pack();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:ScrollInventoryActor.java

示例7: UIElement

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public UIElement(Skin skin)
{
	UI.uiElements.add(this);
	parent = new Table();
	parent.setFillParent(true);
	window = new Window("Unnamed Window", skin);
	window.setModal(BlueIrisViewer.bivSettings.modalUI);
	table = new Table(skin);
	window.add(table);

	hide();

	parent.add(window);
	onCreate(skin, window, table);
}
 
开发者ID:bp2008,项目名称:blueirisviewer,代码行数:16,代码来源:UIElement.java

示例8: IntroScreen

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
IntroScreen(final ParticleGame game) {
    particle_game = game;
    stage = new Stage();
    table = new Table();

    table.setFillParent(true);
    table.setDebug(true);
    stage.addActor(table);

    Skin skin = new Skin();
    
    Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    
    skin.add("white", new Texture(pixmap));
    skin.add("font", game.getFont());

    TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
    final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
    final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
    text_button_style.up = skin.newDrawable("white", button_color);
    text_button_style.down = skin.newDrawable("white", button_color);
    text_button_style.over = skin.newDrawable("white", hover_color);
    text_button_style.font = skin.getFont("font");
    skin.add("default", text_button_style);

    TextButton play_button = new TextButton("play", skin);
    play_button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            particle_game.setScreen(particle_game.getGameSetupScreen());
        }
    });
    table.add(play_button);
}
 
开发者ID:treeman1111,项目名称:Particles,代码行数:37,代码来源:IntroScreen.java

示例9: InventoryDialog

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public InventoryDialog(UserInterface linkedInterface, Integer linkedFieldGold)
{
	super("Inventory", Settings.DEFAULT_SKIN);
	this.linkedInterface = linkedInterface;

	Button closeButton = new CloseButton(this);
	getTitleTable().add(closeButton).size(15, 15).padRight(-5).top().right();

	for (int i = 0; i < numberOfPages; i++)
		inventoryPages.add(new InventoryPage(this, i));
	currentPageButtons.addActor(inventoryPages.get(0));
	addActor(currentPageButtons);

	Table contentTable = this.getContentTable();
	contentTable.add(currentPageButtons);
	VerticalGroup switchButtons = new VerticalGroup().space(0).pad(0).top().padTop(-8).fill();

	for (int i = 0; i < numberOfPages; i++)
	{
		InventoryTextField<Item> switchButton = createSwitchButton(i);
		switchButtons.addActor(switchButton);
		switchPageButtons.add(switchButton);
	}
	switchPageButtons.get(0).setColor(0.5f, 0.5f, 0.5f, 1);

	contentTable.add(switchButtons);
	contentTable.row();
	goldLabel.setValue(linkedFieldGold);
	goldLabel.update();
	contentTable.add(goldLabel).left();
	contentTable.row();

	this.setX(1230);
	this.setY(43);
	this.pack();
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:37,代码来源:InventoryDialog.java

示例10: addSpellInfo

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void addSpellInfo(Spell spell)
{
	Table infoContainer = new Table();
	String humanReadableName = DialogUtils.humanReadableFromItemIdentifier(spell.getIdentifier().toString());
	infoContainer.add(new Label(humanReadableName, Settings.DEFAULT_SKIN)).padRight(10);
	infoContainer.add(new LineBreaker(spell.getDescription(), 40));
	infoContainer.padLeft(10);
	this.add(infoContainer);
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:10,代码来源:SpellListElement.java

示例11: createMenu

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void createMenu() {
    root = new Table();
    root.setFillParent(true);
    stage.addActor(root);
    
    FileHandle fileHandle = Gdx.files.local(Core.DATA_PATH + "/data.json");
    JsonReader reader = new JsonReader();
    JsonValue val = reader.parse(fileHandle);
    
    Label title = new Label(val.getString("title"), skin, "title");
    root.add(title).padTop(50.0f).padBottom(75.0f);
    
    root.row();
    BouncingImage image = new BouncingImage(getCharacter());
    root.add(image);
    
    root.row();
    ImageButton imageButton = new  ImageButton(skin, "play");
    root.add(imageButton).padTop(75.0f).expandY().top();
    imageButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/jump.wav", Sound.class).play();
            showCharacterDialog();
        }
    });
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:28,代码来源:MenuState.java

示例12: SettingsTabbedPane

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public SettingsTabbedPane(Skin skin, int x, int y, HashMap<TextButton, Table> componentMap) {
    this.x = x;
    this.y = y;
    this.componentMap = componentMap;
    baseTable = new Table();
    buttonTable = new Table();
    contentTable = new Table();

    baseTable.add(buttonTable);
    baseTable.row();
    baseTable.add(contentTable);

    this.setPosition(x / 2, y / 1.3f);
    this.setActor(baseTable);
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:16,代码来源:SettingsTabbedPane.java

示例13: createControlsTable

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Table createControlsTable(){
	Table escTable = new Table(Assets._skin);
	Table keyTable = new Table(Assets._skin);
	
	Table table = new Table(Assets._skin);
	
	Image keyW = new Image(Assets._skin , "keyW");
	Image keyA = new Image(Assets._skin , "keyA");
	Image keyS = new Image(Assets._skin , "keyS");
	Image keyD = new Image(Assets._skin , "keyD");
	Image keyESC = new Image(Assets._skin , "keyESC");
	keyTable.add(new Label("Controls" , Assets._skin , "fontVeraBd24" , "white")).colspan(5).spaceBottom(40f).align(Align.center).row();
	keyTable.add(new Label("[W] Move camera Up" , Assets._skin , "default-font" , "green")).padBottom(10f).padRight(8f).colspan(5).align(Align.center).row();
	keyTable.add(keyW).padRight(8f).colspan(5).spaceBottom(5f).align(Align.center).row();
	keyTable.add(new Label("[A] Move camera Left" , Assets._skin , "default-font" , "green")).padRight(10f);
	keyTable.add(keyA).spaceRight(5f);
	keyTable.add(keyS);
	keyTable.add(keyD).spaceLeft(5f);
	keyTable.add(new Label("[D] Move camera Right" , Assets._skin , "default-font" , "green")).padLeft(10f).row();
	keyTable.add(new Label("[S] Move camera Down" , Assets._skin , "default-font" , "green")).colspan(5).align(Align.center).padTop(10f);
	escTable.add(new Label("[Esc] Pause game", Assets._skin , "default-font" , "green")).padBottom(10f).row();
	escTable.add(keyESC);
	table.add(keyTable);
	table.add(escTable).spaceBottom(20f).row();
	table.add(backBtn).align(Align.bottom).padTop(50f);
	table.setFillParent(true);
	table.center();
	return table;
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:30,代码来源:TutorialStage.java

示例14: MidSection

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public MidSection(Skin skin) {
	this.setSkin(skin);
       Table waveInfoContainer = new Table(skin);
       Table waveTable = new StatPanel(skin);
       Table nextEnemyTable = new StatPanel(skin);
       Table nextWaveTable = new StatPanel(skin);
       Table buttonContainer = new Table(skin);
       // labels
       Label waveText = new Label("Wave:", skin , "fontHemi20" , "white");
       Label nextEnemyText = new Label("Next Enemy", skin, "fontHemi20", "white");
       _currentWave = new Label("0",skin , "fontHemi20" , "white");
       Label maxWaves = new Label(" / " + PlayState.MAX_WAVES , skin , "fontHemi20" , "white");
       _next_enemy_value = new Label("",skin , "fontHemi20","white");
       
       Label nextWaveTimeText = new Label("In:", skin, "fontHemi20", "white");
       _next_wave_time_value = new Label("",skin , "fontHemi20","white");
       // buttons
       _nextWaveBtn = new TextButton("START",skin);
       // tables
       
       waveTable.add(_currentWave);
       waveTable.add(maxWaves);
       waveInfoContainer.add(waveText).expand().align(Align.left).row();
       waveInfoContainer.add(waveTable).colspan(2).expand().fill().row();
       waveInfoContainer.add(nextEnemyText).align(Align.bottomLeft);
       waveInfoContainer.add(nextWaveTimeText).align(Align.bottomLeft).row();
       nextEnemyTable.add(_next_enemy_value).align(Align.center);
       nextWaveTable.add(_next_wave_time_value).align(Align.bottom).expand().prefWidth(62).align(Align.center);
       waveInfoContainer.add(nextEnemyTable).align(Align.bottomLeft).expand().spaceRight(3f);
       waveInfoContainer.add(nextWaveTable).align(Align.bottomRight).expand().spaceLeft(3f);
       waveInfoContainer.setWidth(150);
       this.add(waveInfoContainer).expand().align(Align.bottom).row();
       buttonContainer.add(_nextWaveBtn).expand().fill().spaceTop(0);
       this.add(buttonContainer).expand().fillX().spaceTop(5).align(Align.bottom).padBottom(2);
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:36,代码来源:MidSection.java

示例15: Hud

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Hud(SpriteBatch batch){
    viewport = new FillViewport(Config.SCREEN_WIDTH,Config.SCREEN_HEIGHT,new OrthographicCamera());
    stage = new Stage(viewport,batch);
    labelHP = new Label("HP: 100/100", Assets.getInstance().getSkin());
    labelVP = new Label("VP: 100/100",Assets.getInstance().getSkin());

    table = new Table();
    table.setFillParent(true);
    table.top().right().padTop(20).padRight(20).setDebug(false);
    table.add(labelHP);
    table.row();
    table.add(labelVP);
    stage.addActor(table);
}
 
开发者ID:guojiank,项目名称:skycity,代码行数:15,代码来源:Hud.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Table.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。