Java 类com.badlogic.gdx.scenes.scene2d.ui.Image 实例源码

项目:Inspiration    文件:InventorySlot.java   
public InventorySlot(){
    _filterItemType = 0; //filter nothing
    _defaultBackground = new Stack();
    _customBackgroundDecal = new Image();
    Image image = new Image(Assets.instance.STATUSUI_SKIN,"cell");

    numItemsLabel = new Label(String.valueOf(numItemsVal), Assets.instance.STATUSUI_SKIN);
    numItemsLabel.setAlignment(Align.bottomRight);
    numItemsLabel.setVisible(false);

    _defaultBackground.add(image);

    _defaultBackground.setName("background");
    numItemsLabel.setName("numitems");

    this.add(_defaultBackground);
    this.add(numItemsLabel);
}
项目:cocos-ui-libgdx    文件:CCSpriteViewTest.java   
@Test
@NeedGL
public void shouldParseSpriteView() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("animation/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Image image = group.findActor("st_2");
    Array<Action> actions = image.getActions();
    assertThat(actions.size, is(1));
    RepeatAction repeatAction = (RepeatAction) actions.get(0);
    ParallelAction parallelAction = (ParallelAction) repeatAction.getAction();
    assertThat(parallelAction.getActions().size, is(3));
    assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class)));
    SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0);
    SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1);
    assertThat(moveAction.getActions().size, is(4));
    assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class)));
    assertThat(scaleAction.getActions().size, is(4));
    assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class)));
}
项目:dice-heroes    文件:ShowTutorialArrow.java   
private void blink(final Image arrow, final ArrowDirection direction) {
if (direction == ArrowDirection.fromTop || direction == ArrowDirection.fromBottom) {
    arrow.addAction(Actions.sequence(
        Actions.moveBy(0, moveOffset(), periodTime() * 0.25f),
        Actions.moveBy(0, -moveOffset() * 2f, periodTime() * 0.5f),
        Actions.moveBy(0, moveOffset(), periodTime() * 0.25f),
        Actions.run(new Runnable() {
            @Override public void run() {
                blink(arrow, direction);
            }
        })
    ));
} else {
    arrow.addAction(Actions.sequence(
        Actions.moveBy(moveOffset(), 0, periodTime() * 0.25f),
        Actions.moveBy(-moveOffset() * 2f, 0 * 2f, periodTime() * 0.5f),
        Actions.moveBy(moveOffset(), 0, periodTime() * 0.25f),
        Actions.run(new Runnable() {
项目:Catan    文件:KnightHelper.java   
/** Clear the highlighted positions */
public void endMove() {
    if (prevMode != null) {
        validIntersections.clear();
        for (Image knightPosition : highlightedPositions) {
            knightPosition.remove();
        }
        highlightedPositions.clear();

        // Go back to the previous mode
        sessionScreen.aMode = prevMode;
        prevMode = null;

        // re-enable all appropriate actions
        sessionScreen.enablePhase(sessionController.getCurrentGamePhase());
    }
}
项目:feup-lpoo-armadillo    文件:MenuScreen.java   
/**
 * 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());
}
项目:drc-sim-client    文件:StageLoad.java   
/**
 * 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);
}
项目:conquest    文件:MainMenu.java   
@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);
}
项目:GDX-Engine    文件:VRope.java   
public VRope(GdxRopeJoint aJoint,
                Group group, AtlasRegion region,
               //(CCSpriteBatchNode*)spriteSheetArg
                    List<VPoint> points,
                    List<VStick> sticks,
                    List<Image> sprites) {

            joint = aJoint;
//          spriteSheet = spriteSheetArg;
            this.group = group;
            this.region = region;

            vPoints = points;
            vSticks = sticks;
            ropeSprites = sprites;
            numPoints = vPoints.size();
    }
项目:TH902    文件:ImageGroupRenderer.java   
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;
}
项目:Cubes_2    文件:SlotActor.java   
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));
}
项目:enklave    文件:ScreenExtensions.java   
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);
}
项目:enklave    文件:ScreenSetting.java   
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);
}
项目:enklave    文件:ScreenSetting.java   
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);
}
项目:enklave    文件:ScreenCombat.java   
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);
}
项目:MMORPG_Prototype    文件:ShopBuyingDialog.java   
public ShopBuyingDialog(ShopItem item, UserInterface linkedInterface, PacketsSender packetsSender, long shopId)
{
    super(DialogUtils.humanReadableFromItemIdentifier(item.getItem().getIdentifier()), linkedInterface.getDialogs(),
            item.getItem().getId());
    this.item = item;
    totalPrice = new StringValueLabel<>("Total: ", getSkin(), item.getPrice());
    Texture texture = item.getItem().getTexture();
    Image image = new Image(texture);
    Table upperContainer = new Table();
    upperContainer.add(image).width(32).height(32).padRight(43);
    upperContainer.add(numberOfItemsField).width(40).align(Align.right);
    this.getContentTable().add(upperContainer).align(Align.left);
    this.getContentTable().row();
    this.getContentTable().add(totalPrice);
    this.getContentTable().row();
    Button buyButton = ButtonCreator.createTextButton("Buy", () -> tryToBuyAction(packetsSender, shopId, linkedInterface));
    this.getContentTable().add(buyButton);
    pack();
    DialogUtils.centerPosition(this);
}
项目:bobbybird    文件:ScrollerPane.java   
public ScrollerPane(TiledDrawable tiledDrawable, float xSpeed, float ySpeed) {
    this.tiledDrawable = tiledDrawable;
    this.xSpeed = xSpeed;
    this.ySpeed = ySpeed;
    xPosition = 0.0f;
    yPosition = 0.0f;

    Image image = new Image(tiledDrawable);

    innerTable = new Table();
    innerTable.add(image).width(5000);
    scrollPane = new ScrollPane(innerTable);
    scrollPane.setTouchable(Touchable.disabled);
    scrollPane.setSmoothScrolling(false);
    this.add(scrollPane).grow();
}
项目:bobbybird    文件:LoadingState.java   
@Override
public void start() {
    finishedLoading = false;

    stage = new Stage(new ScreenViewport());

    skin = createSkin();

    Image image= new Image(skin, "bg");
    image.setScaling(Scaling.stretch);
    image.setFillParent(true);
    stage.addActor(image);

    root = new Table();
    root.setFillParent(true);
    stage.addActor(root);

    progressBar = new ProgressBar(0, 1, .01f, false, skin);
    progressBar.setAnimateDuration(.1f);
    root.add(progressBar).growX().expandY().pad(20.0f);
}
项目:FlappySpinner    文件:MarketScreen.java   
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);
}
项目:FlappySpinner    文件:GameScreen.java   
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);
}
项目:ExamensArbeteTD    文件:LeftSection.java   
public LeftSection(Skin skin) {
    this.setSkin(skin);

       Table moneyStatPanel = new StatPanel(skin);
       Image coin = new Image(skin , "coin");
       moneyLabel = new Label("",skin , "fontHemi20" , "white");
       moneyStatPanel.add(coin).pad(5).align(Align.left).expand().size(23 , 21);
       moneyStatPanel.add(moneyLabel).align(Align.right).pad(5 , 5 , 5 ,10).expand();
       this.add(moneyStatPanel).align(Align.right).size(120 , 30).spaceBottom(2).row();
       Table grayPanel = new GrayPanel(skin);
       _laserTowerIcon = new Image(skin , "laser-tower-icon");
       _plastmaTowerIcon = new Image(skin , "plastma-tower-icon");
       _missleTurretIcon = new Image(skin,"missile-tower-icon");

       _laserTowerTooltipTable = new LaserTowerTooltipTable(skin, TowerType.BASIC_LASER_TURRET);
       _plastmaTowerTooltipTable = new PlastmaTowerTooltipTable(skin, TowerType.PLASTMA_TOWER);
       _missileTowerTooltipTable = new MissileTowerTooltipTable(skin, TowerType.MISSILE_TURRET);

       _laserTowerIcon.addListener(_laserTowerTooltipTable.getTooltip());
       _plastmaTowerIcon.addListener(_plastmaTowerTooltipTable.getTooltip());
       _missleTurretIcon.addListener(_missileTowerTooltipTable.getTooltip());
       grayPanel.add(_laserTowerIcon).size(32,32).pad(10).align(Align.topLeft);
       grayPanel.add(_plastmaTowerIcon).size(32,32).pad(10).align(Align.topLeft);
       grayPanel.add(_missleTurretIcon).size(32, 32).pad(10).align(Align.topLeft).expand(32,32);
       this.add(grayPanel).expand();
}
项目:Cubes    文件:SlotActor.java   
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));
}
项目:Hexpert    文件:PlayStage.java   
private Image getImgBySelection(BuildingType selection)
{
    switch (selection) {
        case NONE:
            break;
        case FARM:
            return imgFarm;
        case HOUSE:
            return imgHouse;
        case MINE:
            return imgMine;
        case WIND:
            return imgWind;
        case FACTORY:
            return imgFactory;
        case MARKET:
            return imgMarket;
        case BANK:
            return imgBank;
        case ROCKET:
            return imgRocket;
    }
    return null;
}
项目:Hexpert    文件:TileEffectDialog.java   
public TileEffectDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);
    getContentTable().defaults().pad(15);

    for(int i = 0; i < TileType.values().length; i++)
    {
        TileType tileType = TileType.values()[i];
        Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png")));
        getContentTable().add(tileImage).width(96).height(96);

        Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin);
        lblDesc.setAlignment(Align.center);
        getContentTable().add(lblDesc);
        getContentTable().row();
    }
}
项目:Hexpert    文件:BuildingScoreDialog.java   
public BuildingScoreDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);

    getContentTable().defaults().pad(15);
    Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class);
    Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin);
    lblExplaination.setWrap(true);
    lblExplaination.setAlignment(Align.center);
    getContentTable().add(lblExplaination).colspan(8).width(8*160);
    lblExplaination.setWrap(true);
    getContentTable().row();

    for (int i = 1; i < BuildingType.values().length; i++) {
        BuildingType buildingType = BuildingType.values()[i];
        Image image = new Image(new TextureRegion((Texture)
                hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png")));

        getContentTable().add(image).width(160).height(160);
        Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle);
        lblScore.setAlignment(Align.center);
        getContentTable().add(lblScore).expand();
        if (i % 4 == 0)
            getContentTable().row();
    }
}
项目:le-pendu    文件:MenuScreen.java   
public MenuScreen(final LePendu game) {
    super(game);

    titleImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("title")));
    playBtn  = new ImageButton(new TextureRegionDrawable(game.atlas.findRegion("playBtn")));
    decosImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("decos")));

    table.add(titleImg).top().padTop(169);
    table.row();
    table.add(playBtn).expandY();
    table.row();
    table.add(decosImg).bottom().padBottom(50);

    playBtn.addListener(new ChangeListener() {
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            game.setScreen(new DifficultyScreen(game));
        }
    });
}
项目:fabulae    文件:Map.java   
public Map(GameMap map, GameState gameState, int width, int height, ButtonStyle mapIndicatorStyle) {
    mapTexture = MinimapGenerator.generate(map, gameState, width, height);
    this.gameMap = map;
    this.gameState = gameState;
    calculateRatios(width, height);

    Image image = new Image(mapTexture);
    image.addListener(this);
    // only add the current camera position indicator in case 
    // the camera does not show the whole map already
    if (xRatio > 1 || yRatio > 1) {
        indicator = new MapScreenIndicator(mapIndicatorStyle);
    }

    WidgetGroup group = new WidgetGroup();
    group.addActor(image);
    if (indicator != null) {
        group.addActor(indicator);
        indicator.addListener(this);
    }
    group.setWidth(width);
    group.setHeight(height);
    group.invalidate();
    add(group).width(width).height(height);
}
项目:cll1-gdx    文件:SelectSession.java   
protected ClickListener deleteSessionConfirm(final int session, final Image btnTrashcan,
        final TextButton btnSession) {
    return new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Dialog confirmDelete = new Dialog("ᎯᎠᏍ ᏣᏚᎵᎭ?", skin) {
                protected void result(Object object) {
                    if ("YES".equals(object)) {
                        SlotFolder.getSlotFolder(session).deleteDirectory();
                        btnSession.setText(EMPTY_SLOT+"\n"+nextSessionIndicationText(0l, 0));
                        btnTrashcan.setColor(Color.LIGHT_GRAY);
                        btnTrashcan.clearListeners();
                    }
                };
            };
            confirmDelete.button("ᎥᎥ - YES", "YES");
            confirmDelete.button("ᎥᏝ - NO", "NO");
            confirmDelete.text("Are you sure you want\n" + "to delete this session?\n" + "This cannot be undone!");
            confirmDelete.setModal(true);
            confirmDelete.pack();
            confirmDelete.show(stage);
        }
    };
}
项目:cll1-gdx    文件:LearningSession.java   
protected Image[] getImageFor(String imageFile) {
    if (!assets.isLoaded(IMAGES_BACKDROP)) {
        assets.load(IMAGES_BACKDROP, Texture.class);
        assets.finishLoadingAsset(IMAGES_BACKDROP);
    }
    if (!assets.isLoaded(IMAGES_OVERLAY)) {
        assets.load(IMAGES_OVERLAY, Texture.class);
        assets.finishLoadingAsset(IMAGES_OVERLAY);
    }
    if (!assets.isLoaded(imageFile)) {
        assets.load(imageFile, Texture.class);
        assets.finishLoadingAsset(imageFile);
    }
    assets.finishLoading();
    Image backdrop = new Image(assets.get(IMAGES_BACKDROP, Texture.class));
    refCounts.inc(IMAGES_BACKDROP);
    Image image = new Image(assets.get(imageFile, Texture.class));
    refCounts.inc(imageFile);
    Image overlay = new Image(assets.get(IMAGES_OVERLAY, Texture.class));
    refCounts.inc(IMAGES_OVERLAY);
    backdrop.setScaling(Scaling.fit);
    image.setScaling(Scaling.fit);
    overlay.setScaling(Scaling.fit);
    return new Image[] { backdrop, image, overlay };// choice1;
}
项目:joe    文件:HUD.java   
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);
}
项目:fabulae    文件:CampPanel.java   
public void rebuild() {
    clearChildren();

    add(new Image(style.images[MathUtils.random(0, style.images.length-1)], Scaling.none)).fill().padBottom(style.imageMarginBottom);
    row();
    Table foodWaterInfo = new Table();
    foodWaterInfo.add(food).fill().expandX();
    foodWaterInfo.add(water).fill().expandX();
    add(foodWaterInfo).fill();
    row();
    add(buildSelects()).fill();
    row();
    add(buildButtons()).fill().padTop(style.buttonsMarginTop);

    recalculateChangedItems();

    playMusic();
}
项目:dice-heroes    文件:CraftingPane.java   
public CraftingPane(int elementsCount, Array<Ability> recipes) {
        super(Config.skin);
        this.inputs = new ObjectMap<Actor, ItemIcon>(elementsCount);
        this.count = elementsCount;
        this.recipes = recipes;
//        defaults().pad(2);
        for (int i = 0; i < elementsCount; i++) {
            Image image = new Image(Config.skin, "ui-crafting-slot");
            image.setName("slot#" + i);
            inputs.put(image, null);
            add(image).size(26);
            if (i != elementsCount - 1) {
                add(new Tile("ui-plus")).pad(1);
            } else {
                add(new Tile("ui-equals")).pad(1);
            }
        }
        add(output).size(26);
        setTouchable(Touchable.enabled);
    }
项目:GDefence    文件:LevelShopSource.java   
@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;
    }
项目:cachebox3.0    文件:CheckStateActivity.java   
public CheckStateActivity() {
        super("CheckStateActivity");
        bCancel = new CharSequenceButton(Translation.get("cancel"));
        gsLogo = new Image(CB.getSkin().getIcon.GC_Live);
        lblTitle = new VisLabel(Translation.get("chkApiState"));
        Label.LabelStyle style = new Label.LabelStyle(lblTitle.getStyle());
        style.fontColor.set(Color.WHITE);
        lblTitle.setStyle(style);
        Drawable animationDrawable = VisUI.getSkin().getDrawable("download-animation");
        workAnimation = new Image(animationDrawable);
        progressBar = new VisProgressBar(0, 100, 1, false, "default");

        createOkCancelBtn();
        setWorkAnimationVisible(false);

        this.setStageBackground(new ColorDrawable(VisUI.getSkin().getColor("dialog_background")));
//        this.setDebug(true, true);
    }
项目:cachebox3.0    文件:ButtonDialog.java   
public static Table getMsgContentTable(CharSequence msg, MessageBoxIcon icon) {
    Skin skin = VisUI.getSkin();

    ButtonDialogStyle style = skin.get("default", ButtonDialogStyle.class);
    Table contentTable = new Table(skin);
    if (icon != MessageBoxIcon.None && icon != null) {
        Image iconImage = new Image(getIcon(icon));
        contentTable.add(iconImage).width(iconImage.getWidth()).top().pad(CB.scaledSizes.MARGIN);
    }
    contentTable.defaults().space(2).padLeft(3).padRight(3);

    Label msgLabel = new Label(msg, new Label.LabelStyle(style.titleFont, style.titleFontColor));
    msgLabel.setWrap(true);
    contentTable.add(msgLabel).expand().fill();
    contentTable.pack();
    contentTable.layout();
    return contentTable;
}
项目:cocos-ui-libgdx    文件:CCLoadingBar.java   
@Override
public Actor parse(CocoStudioUIEditor editor, ObjectData widget) {

    if (widget.getImageFileData() == null) {
        return new Image();
    }

    TextureRegion textureRegion = editor.findTextureRegion(widget, widget.getImageFileData()
            .getPath());
    if (textureRegion == null) {
        return new Image();
    }
    TLoadingBar loadingBar = new TLoadingBar(textureRegion);
    loadingBar.setValue(widget.getProgressInfo());

    return loadingBar;
}
项目:dice-heroes    文件:ArrowMessageNet.java   
@Override protected Table getMessageTable() {

        LocLabel label = new LocLabel(locKey);
        label.setWrap(true);
        label.setAlignment(Align.center);

        Label tapToContinue = new LocLabel("tap-to-continue", ShowTutorialMessage.Message.TAP_TO_CONTINUE);
        tapToContinue.setWrap(true);
        tapToContinue.setAlignment(Align.center);

        Table result = new Table();
        result.align(Align.top);
        result.add(label).width(stage.getWidth() / 1.5f).row();
        result.add(new Image(Config.skin, "ui-creature-info-line")).width(120).padTop(4).row();
        result.add(tapToContinue);
        return result;
    }
项目:dice-heroes    文件:TutorialMessageWindow.java   
@Override protected void initialize() {
    Table table = new Table(Config.skin);
    table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background"));

    label = new LocLabel("", DieMessageWindow.ACTIVE);
    label.setWrap(true);
    label.setAlignment(Align.center);

    table.setTouchable(Touchable.disabled);

    Label tapToContinue = new LocLabel("tap-to-continue", DieMessageWindow.INACTIVE);
    tapToContinue.setWrap(true);
    tapToContinue.setAlignment(Align.center);

    if (image != null) {
        image.setTouchable(Touchable.disabled);
        table.add(image).padTop(-15 - dy).row();
    }
    final Cell<LocLabel> cell = table.add(label).width(100);
    if (forceLabelHeight) cell.height(labelHeight);
    cell.row();
    table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row();
    table.add(tapToContinue).width(80).row();

    this.table.add(table);
}
项目:libgdx_ui_editor    文件:PreviewWidget.java   
private Image fitNinePatch(NinePatch horizontalPatch, float width, float height, float scl) {
    horizontalPatch.scale(scl, scl);

    Image img = new Image(horizontalPatch);
    img.setScaleX(width / horizontalPatch.getTotalWidth());
    img.setScaleY(height / horizontalPatch.getTotalHeight());

    return img;
}
项目:libgdx_ui_editor    文件:XmlUtils.java   
public static void parseUqAttr(Actor actor, XmlReader.Element element){
    Class cls  = EditorManager.getInstance().getActorType(actor);
    if (cls.equals(Label.class)){
        parseLabel((Label) actor,element);
    }else if (cls.equals(Image.class)){
        parseImage((Image) actor,element);
    }else if (cls.equals(Button.class)){
        parseButton((VisImageButton) actor,element);
    }else if (cls.equals(TextField.class)){
        parseTextField((TextField) actor,element);
    }
}
项目:libgdx_ui_editor    文件:XmlUtils.java   
public static void attr2Image(Image image, String imagePath,boolean isNine,int[] nines){
    HashMap hashMap = getActorAttr(image);
    if (imagePath!=null)hashMap.put("image",imagePath);
    hashMap.put("isNine",isNine);
    if (isNine ){
        hashMap.put("left",nines[0]);
        hashMap.put("right",nines[1]);
        hashMap.put("top",nines[2]);
        hashMap.put("bottom",nines[3]);
    }
    image.setUserObject(hashMap);
}