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


Java Image.setSize方法代码示例

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


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

示例1: setUpMoneyLabel

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpMoneyLabel() {
    moneyImage = new Image(AssetsManager.getTextureRegion(Constants.COIN_NAME));
    moneyImage.setSize(2.5f, 2.5f);
    moneyImage.setPosition(Constants.WIDTH * 2 / 3 + 0.5f, onFinish.getY() + onFinish.getHeight() * 1.3f + moneyImage.getHeight() / 5.5f);
    moneyImage.setOrigin(moneyImage.getWidth() / 2, moneyImage.getHeight() / 2);
    moneyImage.setVisible(false);
    stage.addActor(moneyImage);

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

示例2: 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

示例3: 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

示例4: 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

示例5: addTestCombat

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addTestCombat(){
    groupTestCombat = 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.15f);
    groupChangeFaction.addActor(background);
    Label labelFac = new Label("Combat Training",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.loadAssetsEnklaveScreen();
            new GetEnklaveDetails().makeRequest(16066, manager);
            gameManager.screenEnklave.setEnklave3D(new Vector2(0,0));
            gameManager.setScreen(new ScreenCircleLoading(gameManager,gameManager.screenEnklave,manager.getAssertEnklaveScreen()));;
        }
    });
    groupChangeFaction.addActor(labelFac);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:20,代码来源: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: setUpSkinImages

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpSkinImages() {
    skinImage = new Image(skins.get(position).getTextureRegion());
    skinImageRotation = new Image(skins.get(position).getTextureRegion());

    skinImage.setSize(3f, 3f);
    skinImage.setOrigin(skinImage.getWidth() / 2, skinImage.getHeight() / 2);
    skinImage.setPosition(Constants.WIDTH / 3 - skinImage.getWidth() / 2, Constants.HEIGHT / 2);

    skinImageRotation.setSize(3f, 3f);
    skinImageRotation.setOrigin(skinImageRotation.getWidth() / 2, skinImageRotation.getHeight() / 2);
    skinImageRotation.setPosition(Constants.WIDTH * 2 / 3 - skinImageRotation.getWidth() / 2, Constants.HEIGHT / 2);

    SequenceAction rotateAction = new SequenceAction();
    rotateAction.addAction(Actions.rotateBy(360, 0.5f, Interpolation.linear));
    RepeatAction infiniteLoop = new RepeatAction();
    infiniteLoop.setCount(RepeatAction.FOREVER);
    infiniteLoop.setAction(rotateAction);

    skinImageRotation.addAction(infiniteLoop);
    stage.addActor(skinImageRotation);
    stage.addActor(skinImage);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:23,代码来源:MarketScreen.java

示例8: createInfoLabel

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void createInfoLabel() {
    infoBackground = new Image();
    TextureRegionDrawable image =
            new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default"));
    infoBackground.setDrawable(image.tint(new Color(0, 0, 0, 0.6f)));
    infoBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getWidth() / 20);
    stage.addActor(infoBackground);

    infoLabel = new Label("", skin);
    FreeTypeFontParameter fontParameter = new FreeTypeFontParameter();
    fontParameter.size = Gdx.graphics.getWidth() / 30;
    LabelStyle style = new LabelStyle();
    style.font = fontGenerator.generateFont(fontParameter);
    style.fontColor = Color.WHITE;
    infoLabel.setStyle(style);
    infoLabel.setWidth(Gdx.graphics.getWidth());
    stage.addActor(infoLabel);
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:19,代码来源:HUD.java

示例9: createProgressCard

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/** Placeholder method for creating progress cards */
Image createProgressCard(ProgressCardType type, float onBoardWidth, float onBoardHeight) {
    // PlaceHolder image

    // TODO: make this connect to a progress card atlas 
    Image progressCardImage = new Image(aSeaTextureSolid);

    // Scale down the image to on board size
    progressCardImage.setSize(onBoardWidth, onBoardHeight);

    return progressCardImage;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:13,代码来源:GamePieces.java

示例10: createKnightPosition

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/**
 * Create an image used to highlight valid positions for a knight.
 *
 * @param localPlayer the local player, always
 */
public Image createKnightPosition(Player localPlayer) {
    Image knightPos = new Image(knightBg);

    // The highlighted position should be a bit transparent
    float alpha = 0.75f;

    // It should also take the color of the local player
    switch (localPlayer.getColor()) {
        case WHITE:
            knightPos.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, alpha);
            break;
        case BLUE:
            knightPos.setColor(Color.BLUE.r, Color.BLUE.g, Color.BLUE.b, alpha);
            break;
        case RED:
            knightPos.setColor(Color.RED.r, Color.RED.g, Color.RED.b, alpha);
            break;
        case ORANGE:
            knightPos.setColor(Color.ORANGE.r, Color.ORANGE.g, Color.ORANGE.b, alpha);
            break;
        case YELLOW:
            knightPos.setColor(Color.YELLOW.r, Color.YELLOW.g, Color.YELLOW.b, alpha);
            break;
    }

    // Scale down the image
    final float knightScale = 1 / 8f;
    knightPos.setSize(knightScale * knightPos.getWidth(), knightScale * knightPos.getHeight());

    // Place the origin in the center of the image to make it easier to draw
    knightPos.setOrigin(knightPos.getWidth() / 2f, knightPos.getHeight() / 2f);

    return knightPos;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:40,代码来源:GamePieces.java

示例11: createCityWall

import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/** Create a city wall image with the provided color */
Image createCityWall(PlayerColor color) {
    // Create the image from the texture region
    Image cityWallImage = new Image(cityWall);

    // Set the color
    switch (color) {
        case WHITE:
            cityWallImage.setColor(Color.WHITE);
            break;
        case BLUE:
            cityWallImage.setColor(Color.BLUE);
            break;
        case RED:
            cityWallImage.setColor(Color.RED);
            break;
        case ORANGE:
            cityWallImage.setColor(Color.ORANGE);
            break;
        case YELLOW:
            cityWallImage.setColor(Color.YELLOW);
            break;
    }

    // Scale down the image
    final float imageScale = 1 / 4f;
    cityWallImage.setSize(imageScale * cityWallImage.getWidth(), imageScale * cityWallImage.getHeight());

    // Place the origin in the center of the image to make it easier to draw
    cityWallImage.setOrigin(cityWallImage.getWidth() / 2f, cityWallImage.getHeight() / 2f);

    return cityWallImage;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:34,代码来源:GamePieces.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.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

示例13: 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

示例14: 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

示例15: 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


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