本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.Stage類的典型用法代碼示例。如果您正苦於以下問題:Java Stage類的具體用法?Java Stage怎麽用?Java Stage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Stage類屬於com.badlogic.gdx.scenes.scene2d包,在下文中一共展示了Stage類的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: Hud
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
public Hud(SpriteBatch sb) {
countKill = 0;
viewport = new FitViewport(ScreenConf.V_WIDTH, ScreenConf.V_HEIGHT, new OrthographicCamera());
stage = new Stage(viewport, sb);
Table table = new Table();
table.setFillParent(true);
table.top();
countKillLabel = new Label(String.format("%03d", countKill), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(countKillLabel).expandX().padTop(10);
table.add().expandX();
table.add().expandX();
table.add().expandX();
stage.addActor(table);
}
示例3: displayActions
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
public KnightActionsWindow displayActions(Stage stage) {
if (stage != null) {
// Create the window if it's not created
if (actionWindow == null)
actionWindow = new KnightActionsWindow(this);
actionWindow.setPosition(getX() + getWidth(), getTop());
// Add the window if not already added
if (!actionWindow.hasParent())
stage.addActor(actionWindow);
return actionWindow;
}
return null;
}
示例4: MenuScreen
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
/**
* Menu Screen's constructor.
* It initializes all the Menu elements.
*
* @param game The current game session.
*/
protected MenuScreen(final Armadillo game) {
this.game = game;
batch = game.getBatch();
gameServices = game.getGameServices();
skin1 = game.getPrimarySkin();
skin2 = game.getSecondarySkin();
viewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
viewport.apply();
stage = new Stage(viewport, batch);
backgroundImg = new Image(game.getAssetManager().get("background.png", Texture.class));
backgroundImg.setScale(VIEWPORT_WIDTH / backgroundImg.getWidth(), VIEWPORT_HEIGHT / backgroundImg.getHeight());
titleImg = new Image(game.getAssetManager().get("armadillo_title.png", Texture.class));
titleImg.setSize(0.8f * titleImg.getWidth(), 0.8f * titleImg.getHeight());
titleImg.setPosition(VIEWPORT_WIDTH / 2 - titleImg.getWidth() / 2, VIEWPORT_HEIGHT * 0.98f - titleImg.getHeight());
}
示例5: create
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void create () {
camera = new OrthographicCamera();
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
stage = new Stage();
stage.addListener(new InputListener(){
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button){
stage.getActors().get(counter).addAction(Actions.moveTo(x-50,y-50,1));
counter++;
if(counter==stage.getActors().size) {
counter=0;
}
return true;
}
});
Gdx.input.setInputProcessor(stage);
}
示例6: setStage
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
protected void setStage(Stage stage) {
if (stage == null) {
for (int i = 0; i < 9; i++) {
if (c.itemStacks[i] != null)
InventoryHelper.addItemstack(Cubes.getClient().player.getInventory(), c.itemStacks[i]);
}
}
super.setStage(stage);
}
示例7: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void show() {
player = new Player(Assets.random());
client = new Client(player);
stage = new Stage();
Image logo = new Image(Assets.LOGO);
logo.setPosition((Gdx.graphics.getWidth() - logo.getWidth()) / 2, Gdx.graphics.getHeight() * 0.85f);
Image shadow = dropShadow(logo);
stage.addActor(logo);
stage.addActor(shadow);
stage.addActor(new PlayGroup(client));
stage.getRoot().addCaptureListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (!(event.getTarget() instanceof TextField)) stage.setKeyboardFocus(null);
return true;
}
});
Gdx.input.setInputProcessor(stage);
}
示例8: HudScene
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
public HudScene(SpriteBatch batch, ShapeRenderer shapeRenderer, ArcRenderer arcRenderer) {
this.batch = batch;
stage = new Stage();
VisUI.load();
Table table = new Table();
table.top();
table.setFillParent(true);
scoreLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
setScore(score);
balanceLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
setBalance(balance);
table.add(scoreLabel).align(Align.left).expandX();
table.add(balanceLabel).align(Align.right).expandX();
stage.addActor(table);
ringButton = new RingButton(shapeRenderer, arcRenderer);
ringButton.setBounds(10, 10, 100, 100);
stage.addActor(ringButton);
}
示例9: start
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void start() {
finishedLoading = false;
stage = new Stage(new ScreenViewport());
skin = createSkin();
Image image= new Image(skin, "bg");
image.setScaling(Scaling.stretch);
image.setFillParent(true);
stage.addActor(image);
root = new Table();
root.setFillParent(true);
stage.addActor(root);
progressBar = new ProgressBar(0, 1, .01f, false, skin);
progressBar.setAnimateDuration(.1f);
root.add(progressBar).growX().expandY().pad(20.0f);
}
示例10: MenuScreen
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
public MenuScreen(Game game) {
Box2D.init();
this.game = game;
world = new World(new Vector2(0, 0), false);
stage = new Stage(new StretchViewport(Constants.WIDTH, Constants.HEIGHT));
preferences = new GamePreferences();
audioManager = AudioManager.getInstance();
Gdx.input.setInputProcessor(stage);
FlappySpinner.gameManager.changeBackgroundColor("#4ec0ca");
setUpBackground();
setUpButtons();
setUpLogo();
}
示例11: create
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
public void create() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
//font = new BitmapFont();
//skin = new Skin();
//buttonAtlas = new TextureAtlas(Gdx.files.internal());
//skin.addRegions(buttonAtlas);
button = new Button();
button.setStyle(new Button.ButtonStyle());
button.addCaptureListener(new EventListener() {
@Override
public boolean handle(Event event) {
Gdx.app.log("LOG", "event " + event);
return false;
}
});
stage.addActor(button);
}
示例12: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
/**
* Method responsible for initializing the main menu
* Called when the screen becomes the current screen of the game
*/
@Override
public void show() {
cam = new OrthographicCamera();
viewport = new FitViewport(1920, 1080);
viewport.setCamera(cam);
stage = new Stage(viewport);
stage.setViewport(viewport);
skin = settingsAssets.styles_json;
int x = 1920;
int y = 1080;
spriteBatch = new SpriteBatch();
mainbackground = settingsAssets.testmainscreen;
BitmapFont font = settingsAssets.bocklin_fnt;
TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton);
inputTable = new Table();
keys = IInputConfig.InputKeys.values();
keyMap = new HashMap<>();
initInputRows(font, backgroundTexture);
createBackButton();
AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
示例13: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void show() {
if(drawone){
addBackgroundExtension();
addPuls();
addimagebg();
addButtonBottom();
drawone = false;
}
cameraGroupStrategy = new CameraGroupStrategy(camera);
batch = new DecalBatch(cameraGroupStrategy);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
addtostage();
Gdx.input.setCatchBackKey(true);
inputmulti = new InputMultiplexer();
inputmulti.addProcessor(stage);
Gdx.input.setInputProcessor(inputmulti);
}
示例14: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void show() {
if(drawone){
addroomselect();
addButtonBottom();
addPuls();
addimagebg();
addbuildRoom();
addtimerbuildroom();
drawone = false;
}
cameraGroupStrategy = new CameraGroupStrategy(camera);
// CameraInputController controller = new CameraInputController(camera);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
batchsprite = new SpriteBatch();
addtostage();
batch = new DecalBatch(this.cameraGroupStrategy);
Gdx.input.setCatchBackKey(true);
InputMultiplexer inputmulti = new InputMultiplexer();
inputmulti.addProcessor(stage);
Gdx.input.setInputProcessor(inputmulti);
}
示例15: show
import com.badlogic.gdx.scenes.scene2d.Stage; //導入依賴的package包/類
@Override
public void show() {
if(drawone){
addActiveRooms();
createBuildRoom();
createAddExtensionGroup();
addDescribeEnklave();
drawone = false;
}
backButton.setChecked(false);
Gdx.input.setCatchBackKey(true);
stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
addtoStage(stage);
stage.addActor(backButton);
Gdx.input.setInputProcessor(stage);
}