当前位置: 首页>>代码示例>>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;未经允许,请勿转载。