本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.Stage.addActor方法的典型用法代碼示例。如果您正苦於以下問題:Java Stage.addActor方法的具體用法?Java Stage.addActor怎麽用?Java Stage.addActor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.Stage
的用法示例。
在下文中一共展示了Stage.addActor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createLoadingStage
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public Stage createLoadingStage(){
Stage stage = createStage();
stage.setViewport(viewport);
stage.addActor(new GameObjectBodyless(new Texture("default_background.png")));
GameObjectBodyless gameObjectBodyless = new GameObjectBodyless(new Texture("loading_screen_part1.png")){
@Override
public void act(float delta) {
super.act(delta);
getSprite().setOriginCenter();
getSprite().rotate(3);
}
};
gameObjectBodyless.setPosition(viewport.getScreenWidth() - gameObjectBodyless.getSprite().getWidth(),
viewport.getScreenHeight() - gameObjectBodyless.getSprite().getHeight());
stage.addActor(gameObjectBodyless);
return stage;
}
示例2: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public void show() {
if (!init) {
loadingScreenAssets = new Assets.LoadingScreenAssets();
AL.getAssetManager().loadAssetFields(loadingScreenAssets);
AL.getAssetManager().finishLoading();
font = new BitmapFont();
batch = new SpriteBatch();
cam = new OrthographicCamera();
viewport = new FitViewport(1920, 1080);
viewport.setCamera(cam);
stage = new Stage(viewport);
stage.setViewport(viewport);
skin = loadingScreenAssets.styles_json;
loadingScreenBar = new ProgressBar(0, 100, 1, false, skin);
loadingScreenBar.setPosition(25, -10);
loadingScreenBar.setSize(1890, 50);
stage.addActor(loadingScreenBar);
}
init = true;
}
示例3: initHud
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
private void initHud() {
hud = new Stage(viewport, batch);
Gdx.input.setInputProcessor(new InputMultiplexer(new KeyboardInputHandler(), hud));
//init widgets
ColorButton[] colorButtons = createColorButtons();
final ShapeButton[] shapeButtons = createShapeButtons(colorButtons);
// add widgets to stage
for (ShapeButton shapeButton : shapeButtons) {
hud.addActor(shapeButton);
}
for (ColorButton colorButton : colorButtons) {
hud.addActor(colorButton);
}
TextureAtlas textureAtlas = polymorph.getAssetManager().get(Polymorph.MASTER_PATH, TextureAtlas.class);
hud.addActor(createHealthBar(textureAtlas));
hud.addActor(createPauseButton(textureAtlas));
}
示例4: AddStage
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public void AddStage(Stage stage){
// stage.addActor(groupturret1);
// stage.addActor(groupturret2);
// stage.addActor(groupturret3);
stage.addActor(groupShield);
stage.addActor(groupButtonAction);
}
示例5: createStartStage
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public Stage createStartStage(){
Stage stage = createStage();
stage.setViewport(viewport);
stage.addActor(new GameObjectBodyless(new Texture("splash_screen1.png")){
private int i = 100;
private int counter = 0;
@Override
public void act(float delta) {
super.act(delta);
if (i < 0){
i = 100;
counter++;
if (counter == 2){
remove();
setChanged();
notifyObservers("StartStageEnd");
}
setTexture(new Texture("splash_screen2.png"));
setSprite(new Sprite(getTexture()));
} else if (i >= 0) {
i--;
}
}
});
return stage;
}
示例6: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
manager.loadAssetsChoiceFaction();
manager.getAssetsChoiceFaction().finish();
make();
stage = new Stage(new StretchViewport(WIDTH,HEIGHT));
modelBatch = new ModelBatch();
stage.addActor(group);
}
示例7: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
bg = new Texture("BG.png");
bg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
stage = new Stage();
Gdx.input.setInputProcessor(stage);
if (skin == null)
createBasicSkin();
// Create & add the window
CatanWindow window = new CatanWindow(TITLE, skin);
stage.addActor(window);
Label usernameLabel = new Label ("Username:", skin);
TextField usernameText = new TextField ("", skin);
Label passwordLabel = new Label ("Password:", skin);
TextField passwordText = new TextField("", skin);
/*//Create table
Table mainTable = new Table();
//add labels to table
mainTable.add(usernameLabel);
mainTable.add(usernameText).width(200);
mainTable.row();
mainTable.add(passwordLabel);
mainTable.add(passwordText).width(200);
mainTable.setFillParent(true);
stage.addActor(mainTable);*/
}
示例8: addDialog
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public void addDialog(Stage stage) {
stage.addActor(mWindow);
if (mBackBtn != null) {
stage.addActor(mBackBtn);
}
if (mConfirmBtn != null) {
stage.addActor(mConfirmBtn);
}
}
示例9: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
if(drawone) {
initializeMenuTab();
drawProfile();
addInformation();
drawone = false;
}
addInfoUser();
sp.setScrollPercentX(0);
sp.updateVisualScroll();
b1.setChecked(true);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight())){
@Override
public boolean keyDown(int keyCode) {
if(keyCode == Input.Keys.BACK)
gameManager.setScreen(gameManager.mapsScreen);
return super.keyDown(keyCode);
}
};
stage.addActor(backButton);
stage.addActor(groupUser);
stage.addActor(groupInformation);
stage.addActor(ta);
queueDisplay.AddtoStage(stage);
batchDecal = new DecalBatch(new CameraGroupStrategy(camera));
modelBatch = new ModelBatch();
Gdx.input.setInputProcessor(stage);
Gdx.input.setCatchBackKey(true);
}
示例10: Hud
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public Hud() {
stage = new Stage();
background = Color.valueOf("#626262");
timer.setAlignment(Align.bottom, Align.center);
stage.addActor(timer);
}
示例11: initGuiInGame
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的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);
}
示例12: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
if(!draw){
draw = true;
addBackground();
addtoStage();
}
stage = new Stage(new StretchViewport(Width,Height));
decalBatch = new DecalBatch(new CameraGroupStrategy(camera));
stage.addActor(groupStage);
modelBatch = new ModelBatch();
Gdx.input.setInputProcessor(stage);
}
示例13: QuestPosition
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
public QuestPosition(String questName, String questDescription, Stage containerForPopUpDialog, PacketsSender packetsSender)
{
setSkin(Settings.DEFAULT_SKIN);
Label questNameLabel = new Label(questName, getSkin());
mouseHoverVisibleDescriptionDialog = new MouseHoverVisibleDescriptionDialog(
questNameLabel, questName, questDescription);
containerForPopUpDialog.addActor(mouseHoverVisibleDescriptionDialog);
add(questNameLabel);
Button acceptQuestButton = ButtonCreator.createTextButton("Take", () ->
packetsSender.send(PacketsMaker.makeAcceptQuestPacket(questName)));
add(acceptQuestButton);
}
示例14: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
spriteBatch = new SpriteBatch();
stage = new Stage(new ScreenViewport());
stage.addActor(bg);
Gdx.input.setInputProcessor(stage);
}
示例15: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入方法依賴的package包/類
@Override
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
VisUI.load();
CenteredTableBuilder tableBuilder = new CenteredTableBuilder(new Padding(2, 3));
VisLabel heading = new VisLabel("Options");
heading.setColor(Color.BLACK);
tableBuilder.append(heading).row();
stage.addActor(heading);
VisLabel temp = new VisLabel("To Be Implemented");
temp.setColor(Color.BLACK);
tableBuilder.append(temp).row();
stage.addActor(temp);
VisTextButton backButton = new VisTextButton("Back");
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen());
}
});
tableBuilder.append(backButton).row();
stage.addActor(backButton);
Table table = tableBuilder.build();
table.setFillParent(true);
stage.addActor(table);
}