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


Java Stage类代码示例

本文整理汇总了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;
}
 
开发者ID:hypeofpipe,项目名称:Race99,代码行数:18,代码来源:StageFactory.java

示例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);

}
 
开发者ID:MSLacerda,项目名称:DarkDay,代码行数:20,代码来源:Hud.java

示例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;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:17,代码来源:KnightActor.java

示例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());
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:26,代码来源:MenuScreen.java

示例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);
}
 
开发者ID:cpppwner,项目名称:NoRiskNoFun,代码行数:20,代码来源:NoRiskNoFunDrawFigures.java

示例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);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:11,代码来源:CraftingInventoryActor.java

示例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);
}
 
开发者ID:conquest,项目名称:conquest,代码行数:25,代码来源:MainMenu.java

示例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);
}
 
开发者ID:MiniDigger,项目名称:projecttd,代码行数:26,代码来源:HudScene.java

示例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);
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:22,代码来源:LoadingState.java

示例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();
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:17,代码来源:MenuScreen.java

示例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);
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:21,代码来源:MenuState.java

示例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));
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:28,代码来源:InputSettingsScreen.java

示例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);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:19,代码来源:ScreenExtensions.java

示例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);
    }
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:23,代码来源:ScreenRooms.java

示例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);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:17,代码来源:ScreenDescribeEnklave.java


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