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


Java Image.setVisible方法代碼示例

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


在下文中一共展示了Image.setVisible方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: setUpOnPause

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
/**
 * SETTING ONSTATE IMAGES
 */
public void setUpOnPause() {
    onPause = new Image(AssetsManager.getTextureRegion(Constants.PAUSE_IMAGE_NAME));
    onPause.setVisible(false);
    onPause.setSize(Constants.WIDTH, Constants.ONPAUSE_HEIGHT);
    onPause.setPosition(Constants.WIDTH / 2 - onPause.getWidth() / 2, Constants.HEIGHT / 2 - onPause.getHeight() / 2);
    onPause.setOrigin(onPause.getWidth() / 2, onPause.getHeight() / 2);
    onPause.addAction(setOnStateImageAction(1.2f));
    stage.addActor(onPause);
}
 
開發者ID:ZephyrVentum,項目名稱:FlappySpinner,代碼行數:13,代碼來源:GameScreen.java

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

示例4: createFlashImage

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
private void createFlashImage() {
    TextureRegion tr = AssetManager.getInstance().getTextureRegion("default");
    flashImage = new Image(tr);
    flashImage.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    flashImage.setPosition(0, 0);
    flashImage.setVisible(false);
    flashImage.setColor(new Color(0, 0, 0, 0));

    stage.addActor(flashImage);
}
 
開發者ID:alexschimpf,項目名稱:joe,代碼行數:11,代碼來源:HUD.java

示例5: DrawOneAttachers

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
    Group gr = new Group();
    Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
    Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    final Image frame = new Image(new TextureRegion(txt));
    frame.setName("frame");
    frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    gr.addActor(frame);
    if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
    else
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image frameselect = new Image(new TextureRegion(txt));
    frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frameselect.setName("frameselect");
    frameselect.toFront();
    frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    frameselect.setVisible(false);
    gr.addActor(frameselect);
    Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
    labelName.setAlignment(Align.center);
    labelName.setWidth(crop.x*0.18f);
    labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
    gr.addActor(labelName);
    txt = managerAssets.getAssetsCombat().getTexture(photo);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image profile = new Image(new TextureRegion(txt));
    profile.setColor(type);
    profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
    profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
    gr.addActor(profile);
    Skin skin = new Skin();
    skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
    ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
    barStyle.knobBefore = barStyle.knob;
    ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
    bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
    bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
    bar.setValue(energy);
    gr.addActor(bar);
    return gr;
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:45,代碼來源:DrawAttachers.java

示例6: drawoneDefenders

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
private Group drawoneDefenders(String typeFrame,String name,Color type,String photo,float energy,float energymax){
        Group gr = new Group();
        Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
        Vector2 crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frame = new Image(new TextureRegion(txt));
        frame.setName("frame");
        frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frame.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        gr.addActor(frame);
        if(InformationProfile.getInstance().getDateUserGame().getFaction() == InformationEnklave.getInstance().getFaction())
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
        else
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frameselect = new Image(new TextureRegion(txt));
        frameselect.setName("frameselect");
        frameselect.toFront();
        frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frameselect.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        frameselect.setVisible(false);
        gr.addActor(frameselect);
        Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()),new Label.LabelStyle(bt,type));
        labelName.setAlignment(Align.center);
        labelName.setSize(WIDTH * 0.18f, HEIGHT * 0.02f);
        labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
        gr.addActor(labelName);
        txt = managerAssets.getAssetsCombat().getTexture(photo);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image profile = new Image(new TextureRegion(txt));
//        profile.setColor(Color.BLUE);
        profile.setSize(crop.x*0.07f, crop.y*0.07f);
        profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
        gr.addActor(profile);
        Skin skin = new Skin();
        skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite),0,0,(int)(WIDTH*0.004),(int)(WIDTH*0.014)));
        ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white",type));
        barStyle.knobBefore = barStyle.knob;
        ProgressBar bar = new ProgressBar(0, energymax, 1, false, barStyle);
        bar.setSize(WIDTH * 0.14f, HEIGHT * 0.012f);
        bar.setPosition(frame.getX()+frame.getWidth()*0.1f, frame.getY()+frame.getHeight()*0.07f);
        bar.setValue(energy);
        gr.addActor(bar);
        return gr;
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:45,代碼來源:DrawDefenders.java


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