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


Java Image.setDrawable方法代碼示例

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


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

示例1: SlotActor

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
public SlotActor(Inventory inventory, int num) {
  super(new ButtonStyle());

  Image image = new Image();
  image.setScaling(Scaling.fit);
  image.setDrawable(new SlotDrawable());
  image.setTouchable(Touchable.disabled);
  add(image);
  setSize(getPrefWidth(), getPrefHeight());

  this.inventory = inventory;
  this.num = num;

  InventoryManager.newSlot(this);
  addListener(new SlotTooltipListener(this));
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:17,代碼來源:SlotActor.java

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

示例3: dragStart

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
@Override
    public DragAndDrop.Payload dragStart(InputEvent event, float x, float y, int pointer) {


//        if(sourceSlot.isEmpty())return payload;
        TowerObject tower = (TowerObject) sourceSlot.getLast();
        DragAndDrop.Payload payload = super.dragStart(event, x, y, pointer);
        if (payload == null)return null;

        Level.getMap().setBuild(true, tower, payload);   //start drawing build grid

        Image i = ((Image)payload.getValidDragActor());//nullPointer
        Image inv = ((Image)payload.getDragActor());
        TextureRegionDrawable t = new TextureRegionDrawable(new TextureRegion(tower.getPrototype().getTowerTexture()));
        i.setDrawable(t);
        inv.setDrawable(t);
        dragAndDrop.setDragActorPosition(-i.getWidth()/2, i.getHeight()/2);
        return payload;
    }
 
開發者ID:mrDarkHouse,項目名稱:GDefence,代碼行數:20,代碼來源:LevelShopSource.java

示例4: createUI

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
private void createUI() {
    Image background = new Image();
    background.setDrawable(new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("main_menu_background")));
    background.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    background.setPosition(0, 0);
    stage.addActor(background);

    createPlayButton();
    createAudioButton();
    createLoadingLabel();
}
 
開發者ID:alexschimpf,項目名稱:joe,代碼行數:12,代碼來源:MainMenu.java

示例5: show

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
@Override
    public void show() {


        batch = new SpriteBatch();

        viewport = new FitViewport(Constants.DIFFICULTY_WORLD_SIZE_WIDTH, Constants.DIFFICULTY_WORLD_SIZE_HEIGHT);
        renderer = new ShapeRenderer();
        renderer.setAutoShapeType(true);


        stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);
        Skin uiSkin = new Skin(Gdx.files.internal("UiSkin/uiskin.json"));
        button = new TextButton(menucontinue, uiSkin);

        TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
        textButtonStyle.font = font12;
        textButtonStyle.up = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.down = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.checked = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.over = uiSkin.newDrawable("white", Color.DARK_GRAY);
        button.setStyle(textButtonStyle);

        imageLogo = new Image();
        imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png")))));


        /*container=new Container<Image>(imageLogo);
        container.setTransform(true);   // for enabling scaling and rotation
        container.size(100, 100);
        container.setOrigin(Align.center);//container.getWidth() / 2, container.getHeight() / 2);
        container.setPosition(100,100);
        container.setScale(1);  //scale according to your requirement
*/


        Table table = new Table();
        table.setFillParent(true);
        table.add(imageLogo);
        table.row();
        table.add(button).width(450).height(300).pad(10);
        table.row();

        stage.addActor(table);
        //container.addAction(Actions.parallel(/*Actions.moveTo(500, 300, 2.0f),*/Actions.rotate(1.f,1.0f)));//Actions.scaleTo(0.1f, 0.1f,2.0f)));

        button.addListener(new ChangeListener() {
            public void changed (ChangeEvent event, Actor actor) {

                if(!victory || (victory && level == maxNumLevels))
                    game.ShowMenuScreen();
                else
                    game.ShowSuperBullScreen(level +1);

            }
        });





    }
 
開發者ID:luarca84,項目名稱:Caramelos,代碼行數:64,代碼來源:StatusScreen.java

示例6: setImage

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
private void setImage(Image image, Drawable drawable) {
    image.setDrawable(drawable);
    image.setSize(image.getPrefWidth(), image.getPrefHeight());
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:5,代碼來源:Stars.java

示例7: process

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入方法依賴的package包/類
@Override
public void process(final LmlParser parser, final LmlTag tag, final Image actor, final String rawAttributeData) {
    Skin skin = parser.getData().getDefaultSkin();
    TiledDrawable drawable = skin.getTiledDrawable(parser.parseString(rawAttributeData, actor));
    actor.setDrawable(drawable);
}
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:7,代碼來源:ImageTiledLmlAttribute.java


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