當前位置: 首頁>>代碼示例>>Java>>正文


Java Image.setScale方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setScale方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.setScale方法的具體用法?Java Image.setScale怎麽用?Java Image.setScale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.Image的用法示例。


在下文中一共展示了Image.setScale方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: MenuScreen

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的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

示例2: visualize

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
@Override public IFuture<Void> visualize(ITargetOwner result) {
    final Future<Void> future = new Future<Void>();
    SoundManager.instance.playSoundIfExists(soundName);
    Image image = new Image(Config.skin, "effect-luck-image");
    image.setColor(color);
    image.setScale(0, 0);
    image.setOrigin(image.getWidth() / 2, image.getHeight() / 2);
    image.setPosition(
        result.getTarget().getX() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getWidth()) * 0.5f,
        result.getTarget().getY() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getHeight()) * 0.5f + 6
    );
    visualizer.viewController.effectLayer.addActor(image);
    image.addAction(
        Actions.sequence(
            Actions.parallel(
                Actions.scaleTo(0.75f, 0.75f, 0.5f, Interpolation.sine),
                Actions.rotateBy(135, 0.5f)
            ),
            Actions.parallel(
                Actions.scaleTo(0, 0, 0.5f, Interpolation.sine),
                Actions.rotateBy(135, 0.5f)
            ),
            Actions.run(future),
            Actions.removeActor()
        )
    );
    return future;
}
 
開發者ID:ratrecommends,項目名稱:dice-heroes,代碼行數:29,代碼來源:BeamVisualizer.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Image.setScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。