本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.setY方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.setY方法的具體用法?Java Table.setY怎麽用?Java Table.setY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.setY方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGuiInGame
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void initGuiInGame() {
mGuiStage = new Stage(new ScreenViewport());
Table gameScore = new Table();
if (DEBUG_RENDERER) {
gameScore.debug();
}
float scorePanelWidth = Gdx.graphics.getWidth() * 0.8f; // 80 % of screen
float scorePanelHeight = Gdx.graphics.getHeight() * 0.2f; // 20 % of screen
gameScore.setWidth(scorePanelWidth);
gameScore.setHeight(scorePanelHeight);
gameScore.setY(Gdx.graphics.getHeight() - (scorePanelHeight + 30.f));
gameScore.setX((Gdx.graphics.getWidth() - scorePanelWidth) * 0.5f);
gameScore.setBackground(new NinePatchDrawable(
new NinePatch(new Texture(Gdx.files.internal("red_button13.png")), 24, 24, 24, 24)));
gameScore.pad(32.f);
Label scoreLabel = new Label("Score", new Label.LabelStyle(
mDefaultFont, COLOR_FONT));
scoreLabel.setFontScale(1.2f);
gameScore.add(scoreLabel).expand();
gameScore.row();
mScoreLabel = new Label("" + mPointTotal, new Label.LabelStyle(
mDefaultFont, COLOR_FONT));
mScoreLabel.setFontScale(2.0f);
gameScore.add(mScoreLabel).expand();
mGuiStage.addActor(gameScore);
}
示例2: create
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public void create() {
Stage stage = new Stage(new ScreenViewport());
getComponentByType(GuiComponent.class).stage = stage;
Table gameScore = new Table();
float scorePanelWidth = Gdx.graphics.getWidth() * 0.8f; // 80 % of screen
float scorePanelHeight = Gdx.graphics.getHeight() * 0.2f; // 20 % of screen
gameScore.setWidth(scorePanelWidth);
gameScore.setHeight(scorePanelHeight);
gameScore.setY(Gdx.graphics.getHeight() - (scorePanelHeight + 30.f));
gameScore.setX((Gdx.graphics.getWidth() - scorePanelWidth) * 0.5f);
gameScore.setBackground(new NinePatchDrawable(
new NinePatch(new Texture(Gdx.files.internal("red_button13.png")), 24, 24, 24, 24)));
gameScore.pad(32.f);
Label scoreLabel = new Label("Score", new Label.LabelStyle(
mFont, COLOR_FONT));
scoreLabel.setFontScale(1.2f);
gameScore.add(scoreLabel).expand();
gameScore.row();
mScoreLabel = new Label("" + 0, new Label.LabelStyle(mFont, COLOR_FONT));
mScoreLabel.setFontScale(2.0f);
gameScore.add(mScoreLabel).expand();
stage.addActor(gameScore);
}
示例3: LevelSelectScreen
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public LevelSelectScreen(final Hexpert hexpert)
{
super();
this.totalLevels = hexpert.levelIndex.size();
this.hexpert = hexpert;
this.batch = new SpriteBatch();
this.displayBatch = new SpriteBatch();
this.displayLevelCamera = new OrthographicCamera(Const.WIDTH, Const.HEIGHT);
this.shapeRenderer = new ShapeRenderer();
shapeRenderer.setAutoShapeType(true);
this.objectiveTable = new Table();
objectiveTable.setX(100);
objectiveTable.setY(850);
objectiveTable.defaults().pad(20);
getStage().addActor(objectiveTable);
goalCompleteCount = getGoalCompleteCount();
String vertexShader = Gdx.files.internal("shaders/defaultvertex.vs").readString();
String darkShader = Gdx.files.internal("shaders/darkness.fs").readString();
String lockedShader = Gdx.files.internal("shaders/locked.fs").readString();
shdDark = new ShaderProgram(vertexShader, darkShader);
shdLckd = new ShaderProgram(vertexShader, lockedShader);
if (!shdDark.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdDark.getLog());
if (!shdLckd.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdLckd.getLog());
getCamera().translate(450, 415);
getCamera().update();
createLevelSelectGrid();
statsTable = new Table();
statsTable.defaults().width(192).height(192);
ImageButton btnGoldHex = new ImageButton(
new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_CORRECT))));
ImageButton btnAchievements = new ImageButton(
new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_ACHIEVEMENTS))));
btnAchievements.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y) {
if(!hexpert.playServices.isSignedIn())
hexpert.playServices.signIn();
hexpert.playServices.showAchievementsUI();
}
});
lblHexCount = new Label(String.format("x%d", goalCompleteCount), hexpert.getSkin());
statsTable.add(btnGoldHex).width(100).height(100);
statsTable.add(lblHexCount).width(80);
statsTable.add(btnAchievements);
statsTable.row();
lblHighScore = new Label("", hexpert.getSkin());
statsTable.add(lblHighScore).colspan(3);
btnGoldHex.getImageCell().expand().fill();
btnAchievements.getImageCell().expand().fill();
statsTable.setX(1650);
statsTable.setY(885);
getStage().addActor(statsTable);
}