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


Java Image.setPosition方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setPosition方法的具体用法?Java Image.setPosition怎么用?Java Image.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.Image的用法示例。


在下文中一共展示了Image.setPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: show

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

示例3: _init

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void _init(Drawable[] textures, int depth, Vector2[] bias) {
	if (bias != null && bias.length != textures.length)
		throw new IllegalArgumentException();
	group = new Group();
	images = new Image[textures.length];
	for (int i=0; i<textures.length; i++) {
		Drawable texture = textures[i];
		Image image = new Image(texture);
		images[i] = image;
		image.setBounds(0, 0, texture.getMinWidth(), texture.getMinHeight());
		if (bias != null)
			image.setPosition(bias[i].x, bias[i].y, Align.center);
		else
			image.setPosition(0, 0, Align.center);
		group.addActor(image);
	}
	mDepth = depth;
	biases = bias;
}
 
开发者ID:cn-s3bit,项目名称:TH902,代码行数:20,代码来源:ImageGroupRenderer.java

示例4: addBackgroundExtension

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addBackgroundExtension() {
    Image stobottom = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.imageArrowBottom)));
    stobottom.setSize(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getWidth() * 0.22f);
    stobottom.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
    Image selectroomtext = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.txtSelectExtension)));
    selectroomtext.setSize(Gdx.graphics.getWidth() * 0.44f, Gdx.graphics.getHeight() * 0.12f);
    selectroomtext.setPosition(Gdx.graphics.getWidth() / 2 - selectroomtext.getWidth() / 2, Gdx.graphics.getHeight() * 0.815f);
    RepeatAction repeatActioan = new RepeatAction();
    MoveToAction fadedown = new MoveToAction();
    fadedown.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.71f);
    fadedown.setDuration(0.5f);
    MoveToAction fadeup = new MoveToAction();
    fadeup.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
    fadeup.setDuration(1f);
    repeatActioan.setAction(new SequenceAction(fadedown, fadeup));
    repeatActioan.setCount(RepeatAction.FOREVER);
    stobottom.addAction(repeatActioan);
    groupBtn = new Group();
    groupBtn.addActor(stobottom);
    groupBtn.addActor(selectroomtext);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:22,代码来源:ScreenExtensions.java

示例5: addChangeFaction

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addChangeFaction(){
    groupChangeFaction = new Group();
    Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground)));
    background.setSize(Width - Width * 0.03f, Height * 0.1f);
    background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.3f);
    groupChangeFaction.addActor(background);
    Label labelFac = new Label("Change Faction",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE));
    labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2);
    labelFac.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            manager.loadAssetsChoiceFaction();
            gameManager.setScreen(new ScreenCircleLoading(gameManager,new ScreenChoiceFaction(gameManager),manager.getAssetsChoiceFaction()));
        }
    });
    groupChangeFaction.addActor(labelFac);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:18,代码来源:ScreenSetting.java

示例6: drawtopcombat

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void drawtopcombat(){
    groupTop = new Group();
    Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular);
    lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    progressBarEnergy = ProgressBarEnergy.getInstance();
    Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1)));
    imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f);
    imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f);
    imageLeftprofile.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1)
                gameManager.setScreen(gameManager.screenEnklave);
            else
                dialogExit("You can't out from combat!");
        }
    });
    groupTop.addActor(imageLeftprofile);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:20,代码来源:ScreenCombat.java

示例7: StageLoad

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/**
 * Loading stage
 * @param doLoad should resources be loaded? It acts as a splash screen otherwise.
 */
public StageLoad(boolean doLoad) {
	this.doLoad = doLoad;
	// Create icon
	icon = new Image(new Texture("image/icon-512.png"));
	int size = Gdx.graphics.getHeight();
	if (Gdx.graphics.getHeight() > Gdx.graphics.getWidth())
		size = Gdx.graphics.getWidth();
	icon.setSize(size, size);
	icon.setPosition(Gdx.graphics.getWidth() / 2 - size / 2,
			Gdx.graphics.getHeight() / 2 - icon.getHeight() / 2);
	addActor(icon);
	// Loading Text
	Label.LabelStyle loadingStyle = new Label.LabelStyle();
	loadingStyle.font = new BitmapFont(Gdx.files.internal("font/collvetica.fnt"));
	loadingStyle.font.getData().setScale(Gdx.graphics.getHeight() * 2 / 720);
	loading = new Label("DRC Sim", loadingStyle);
	loading.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight() * .2f);
	loading.setAlignment(Align.center);
	addActor(loading);
}
 
开发者ID:rolandoislas,项目名称:drc-sim-client,代码行数:25,代码来源:StageLoad.java

示例8: setUpMoneyLabel

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpMoneyLabel() {
    Image imageCoin = new Image(AssetsManager.getTextureRegion(Constants.COIN_NAME));
    imageCoin.setSize(2.5f, 2.5f);
    imageCoin.setPosition(Constants.WIDTH - imageCoin.getWidth() - 1f, Constants.HEIGHT - imageCoin.getHeight() - 1f);
    stage.addActor(imageCoin);

    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = AssetsManager.getMediumFont();
    moneyLabel = new Label("" + preferences.getUserMoney(), labelStyle);
    moneyLabel.setFontScale(0.065f);
    moneyLabel.setSize(moneyLabel.getWidth() * moneyLabel.getFontScaleX(), moneyLabel.getHeight() * moneyLabel.getFontScaleY());
    moneyLabel.setPosition(imageCoin.getX() - moneyLabel.getWidth(), imageCoin.getY());
    stage.addActor(moneyLabel);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:15,代码来源:MarketScreen.java

示例9: dropShadow

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private Image dropShadow(Image image) {
    Image drop = new Image(Assets.LOGO);
    drop.setPosition(image.getX() + 2.5f, image.getY() - 2.5f);
    drop.setColor(0, 0, 0, 0.15f);

    return drop;
}
 
开发者ID:conquest,项目名称:conquest,代码行数:8,代码来源:MainMenu.java

示例10: addtimerbuildroom

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addtimerbuildroom(){
    grouptimerbuild = new Group();
    Image bg = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles. extensionImgBackground)));
    bg.setSize(Gdx.graphics.getWidth() / 2.75f, Gdx.graphics.getHeight() * 0.33f);
    bg.setPosition(Gdx.graphics.getWidth() / 2 - bg.getWidth() / 2, Gdx.graphics.getHeight()*0.35f);
    grouptimerbuild.addActor(bg);
    Label labelBuildingRoom = new Label("Installing\nExtension",new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.025)),Color.WHITE));
    labelBuildingRoom.setPosition(Gdx.graphics.getWidth() / 2 - labelBuildingRoom.getWidth() / 2, Gdx.graphics.getHeight() / 1.65f);
    grouptimerbuild.addActor(labelBuildingRoom);
    labelprocent = new Label("0%",new Label.LabelStyle(new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.03)),Color.WHITE)));
    labelprocent.setPosition(Gdx.graphics.getWidth() / 2 - labelprocent.getWidth() / 2, Gdx.graphics.getHeight() / 2f - labelprocent.getHeight() / 2);
    grouptimerbuild.addActor(labelprocent);
    grouptimerbuild.setVisible(false);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:15,代码来源:ScreenExtensions.java

示例11: createPuls

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public Group createPuls(float x, float y){
    grPuls = new Group();
    Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial);
    Image image = new Image(new TextureRegion(txt));
    Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    image.setSize(crop.x * 0.135f, crop.y * 0.135f);
    image.setPosition(x, y);
    grPuls.addActor(image);
    txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable);
    Image puls = new Image(new TextureRegion(txt));
    crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
    puls.setSize(1, 1);
    MoveToAction move = new MoveToAction();
    move.setDuration(1);
    move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f);
    MoveToAction mo = new MoveToAction();
    mo.setDuration(0);
    mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
    ScaleToAction scale = new ScaleToAction();
    scale.setScale(WIDTH*0.17f);
    scale.setDuration(1);
    ScaleToAction sc = new ScaleToAction();
    sc.setDuration(0);
    sc.setScale(0);
    RepeatAction repeat = new RepeatAction();
    repeat.setCount(RepeatAction.FOREVER);
    repeat.setAction(new SequenceAction(scale, sc));
    puls.addAction(repeat);
    RepeatAction r = new RepeatAction();
    r.setCount(RepeatAction.FOREVER);
    r.setAction(new SequenceAction(move, mo));
    puls.addAction(r);
    grPuls.addActor(puls);
    return grPuls;
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:37,代码来源:TutorialDialog.java

示例12: addtimerbuildroom

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addtimerbuildroom(){
    grouptimerbuild = new Group();
    Image bg = new Image(new TextureRegion(manager.getAssetsRooms().getTexture(NameFiles.extensionImgBackground)));
    bg.setSize(Gdx.graphics.getWidth() / 2.75f, Gdx.graphics.getHeight() *0.32f);
    bg.setPosition(Gdx.graphics.getWidth() / 2 - bg.getWidth() / 2, Gdx.graphics.getHeight() / 5f);
    grouptimerbuild.addActor(bg);
    Label labelBuildingRoom = new Label("Building Room",new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.025)), Color.WHITE));
    labelBuildingRoom.setPosition(Gdx.graphics.getWidth() / 2 - labelBuildingRoom.getWidth() / 2, Gdx.graphics.getHeight() / 2.2f);
    grouptimerbuild.addActor(labelBuildingRoom);
    labelprocent = new Label("0%",new Label.LabelStyle(new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.03)),Color.WHITE)));
    labelprocent.setPosition(Gdx.graphics.getWidth() / 2 - labelprocent.getWidth() / 2, Gdx.graphics.getHeight() / 3.1f);
    grouptimerbuild.addActor(labelprocent);
    grouptimerbuild.setVisible(false);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:15,代码来源:ScreenRooms.java

示例13: setUpOnFinish

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpOnFinish() {
    onFinish = new Image(AssetsManager.getTextureRegion(Constants.FINISH_IMAGE_NAME));
    onFinish.setVisible(false);
    onFinish.setSize(Constants.WIDTH - 5, Constants.ONFINISH_HEIGHT);
    onFinish.setPosition(Constants.WIDTH / 2 - onFinish.getWidth() / 2, Constants.HEIGHT / 2 - onFinish.getHeight() / 5);
    onFinish.setOrigin(onFinish.getWidth() / 2, onFinish.getHeight() / 2);
    onFinish.addAction(setOnStateImageAction(1.2f));
    stage.addActor(onFinish);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:10,代码来源:GameScreen.java

示例14: drawmap

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void drawmap() {
    MapPixmap imageBG = MapPixmap.getInstance();
    decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1, 1))));
    decalBackground.setPosition(0, 0, 0);
    decalBackground.setDimensions(800, 800);
    decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Texture text = null;
    groupCenter = new Group();
    switch (InformationEnklave.getInstance().getFaction()){
        case 1:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavered);
            break;
        }
        case 2:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklaveblue);
            break;
        }
        case 3:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavegreen);
            break;
        }
    }

    Vector2 crop = Scaling.fit.apply(text.getWidth(),text.getHeight(),WIDTH,HEIGHT);
    Image enklave = new Image(new TextureRegion(text));
    enklave.setSize(crop.x*0.6f,crop.y*0.6f);
    enklave.setPosition(WIDTH / 2 - enklave.getWidth() / 2, HEIGHT / 2 - enklave.getHeight() / 1.7F);
    groupCenter.addActor(enklave);
    labelDistance = new Label("Distance: ",new Label.LabelStyle(Font.getFont((int)(HEIGHT*0.025f)),Color.ORANGE));
    groupCenter.addActor(labelDistance);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:32,代码来源:ScreenCombat.java

示例15: setUpOnResume

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpOnResume() {
    onResume = new Image(AssetsManager.getTextureRegion(Constants.RESUME_IMAGE_NAME));
    onResume.setAlign(Align.center);
    onResume.setSize(Constants.ONRESUME_WIDTH, Constants.ONRESUME_HEIGHT);
    onResume.setOrigin(onResume.getWidth() / 2, onResume.getHeight() / 2);
    onResume.setPosition(Constants.WIDTH / 2 - onResume.getWidth() / 2, Constants.HEIGHT / 2 - onResume.getHeight() * 1.5f);
    onResume.addAction(setOnStateImageAction(0.7f));
    stage.addActor(onResume);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:10,代码来源:GameScreen.java


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