本文整理汇总了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);
}
示例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)));
}
示例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() {
示例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());
}
}
示例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());
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}