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


Java Image類代碼示例

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


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

示例1: InventorySlot

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
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);
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:19,代碼來源:InventorySlot.java

示例2: shouldParseSpriteView

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
@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)));
}
 
開發者ID:varFamily,項目名稱:cocos-ui-libgdx,代碼行數:22,代碼來源:CCSpriteViewTest.java

示例3: blink

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
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() {
 
開發者ID:ratrecommends,項目名稱:dice-heroes,代碼行數:19,代碼來源:ShowTutorialArrow.java

示例4: endMove

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
/** 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());
    }
}
 
開發者ID:teobaranga,項目名稱:Catan,代碼行數:18,代碼來源:KnightHelper.java

示例5: MenuScreen

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
/**
 * 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());
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:26,代碼來源:MenuScreen.java

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

示例7: show

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
@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);
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:25,代碼來源:MainMenu.java

示例8: VRope

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
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();
	}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:18,代碼來源:VRope.java

示例9: _init

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
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;
}
 
開發者ID:cn-s3bit,項目名稱:TH902,代碼行數:20,代碼來源:ImageGroupRenderer.java

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

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

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

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

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

示例15: ShopBuyingDialog

import com.badlogic.gdx.scenes.scene2d.ui.Image; //導入依賴的package包/類
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);
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:21,代碼來源:ShopBuyingDialog.java


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