本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setScaling方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setScaling方法的具体用法?Java Image.setScaling怎么用?Java Image.setScaling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Image
的用法示例。
在下文中一共展示了Image.setScaling方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例2: start
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@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);
}
示例3: getImageFor
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
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;
}
示例4: StartTable
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public StartTable(final GUIController guiCtrl, CameraController oCameraController, InputController inputCtrl, Skin skin){
this.oCameraController = oCameraController;
this.inputCtrl = inputCtrl;
this.setSkin(skin);
this.setFillParent(true);
this.setBackground("dimBG");
final float pad = oCameraController.getViewport().getWorldHeight()*0.1f;
Image img = new Image(skin, "logo");
img.setScaling(Scaling.fit);
this.add(img).height(oCameraController.getViewport().getWorldHeight()*0.4f);
this.row();
Label lblTitle = new Label("Controls:", skin, "bold");
lblTitle.setColor(Color.YELLOW);
lblTitle.setAlignment(Align.center);
this.add(lblTitle).expandX().pad(pad);
this.row();
Label lblDesc = new Label("Touch the screen to guide the ship, touch a target to attack. \n" +
"If life runs out, don't panic! It will come back alive, with fewer life. \n" +
"Fuel is consumed while you move, it regenerates when you stop.\n" +
"Your mission: collect the 4 power-ups from the almighty Motherships, but don't forget to explore, it will make your journey easier!", skin, "default");
lblDesc.setAlignment(Align.topLeft, Align.topLeft);
lblDesc.setWrap(true);
this.add(lblDesc).expand().fill().padLeft(pad).padRight(pad).padBottom(pad);
this.row();
Label lblTouch = new Label("Touch here to start.", skin, "bold");
lblTouch.setAlignment(Align.center);
this.add(lblTouch).expandX().fillX();
ClickListener lblClickListener = new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
guiCtrl.startGame();
}
};
lblTouch.addListener(lblClickListener);
lblDesc.addListener(lblClickListener);
}
示例5: initialize
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override protected void initialize() {
creaturesList.defaults().pad(2);
creaturesList.padTop(12);
Image left = new Image(Config.skin, "ui-creature-queue-gradient-left");
left.setScaling(Scaling.stretchY);
left.setAlign(Align.left);
left.setTouchable(Touchable.disabled);
Image right = new Image(Config.skin, "ui-creature-queue-gradient-right");
right.setScaling(Scaling.stretchY);
right.setAlign(Align.right);
right.setTouchable(Touchable.disabled);
Stack stack = new Stack();
stack.add(new ScrollPane(creaturesList, new ScrollPane.ScrollPaneStyle()));
stack.add(left);
stack.add(right);
Table content = new Table(Config.skin);
content.setTouchable(Touchable.enabled);
content.setBackground("ui-inventory-ability-window-background");
content.defaults().pad(2);
content.add(new LocLabel("ui-turns-order")).row();
content.add(new Image(Config.skin, "ui-creature-info-line")).width(100).row();
content.add(stack).maxWidth(table.getStage().getWidth() - 45).padRight(4).padLeft(4).row();
table.add(content);
}
示例6: updateChangeNameButton
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void updateChangeNameButton(Button button, Params params) {
final Item coin = Config.items.get("coin");
button.setDisabled(params.die.renames == 0 && params.userData.getItemCount(coin) == 0);
button.clearChildren();
if (params.die.renames == 0) {
button.add(new LocLabel("ui-change-name-for")).padLeft(4);
Image image = new Image(Config.skin, "item/coin");
image.setScaling(Scaling.none);
button.add(image).padTop(0).padBottom(-4);
button.add("1").padRight(4);
} else {
button.add(new LocLabel("ui-change-name"));
}
}
示例7: AbilityIconCounter
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public AbilityIconCounter(Ability ability, int value) {
if (ability == null) {
ability = Config.abilities.get("skip-turn");
}
image = new Image(Config.skin.getDrawable("ability/" + ability.name + "-icon"));
if (ability.cost <0) image.setColor(AbilityIcon.unique);
image.setScaling(Scaling.none);
image.setAlign(Align.left | Align.top);
image.moveBy(0, 1);
counter = new Label("", Config.skin, "default", "inventory-counter");
counter.setAlignment(Align.right | Align.bottom);
setCount(value);
addActor(image);
addActor(counter);
setSize(image.getPrefWidth(), image.getPrefHeight());
}
示例8: run
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override
public void run() {
assets.load(TRASH, Texture.class);
assets.finishLoadingAsset(TRASH);
Texture trash = assets.get(TRASH, Texture.class);
Label titleLabel = new Label(TITLE, skin);
titleLabel.setFontScale(.85f);
Table menu = new Table(skin);
menu.setFillParent(true);
menu.defaults().expand();
menu.row();
menu.add(titleLabel);
for (int ix = 0; ix < 4; ix++) {
FileHandle fh = SlotFolder.getSlotFolder(ix).child(CLL1.DECKSTATS);
DeckStats di;
try {
String strJson;
strJson = fh.readString(UTF_8.name());
di = json.fromJson(DeckStats.class, strJson);
} catch (Exception e) {
di = new DeckStats();
di.level = SkillLevel.Newbie;
json.toJson(di, fh);
}
String c = di.level == null ? SkillLevel.Newbie.getEnglish() : di.level.getEnglish();
int a = di.proficiency;
int t = di.activeCards;
String text = c + " - Active Cards: " + t + " - Proficiency: " + a + "%";
if (t == 0) {
text = EMPTY_SLOT;
}
int masterDeckSize = ((CLL1)game).cards.size();
int percentInUse = 100*t/masterDeckSize;
text += "\n" + nextSessionIndicationText(di.nextrun, percentInUse);
Image btnDeleteSession = new Image(trash);
btnDeleteSession.setScaling(Scaling.fit);
btnDeleteSession.setColor(Color.DARK_GRAY);
TextButton btnSession = new TextButton(text, skin);
btnSession.getLabel().setFontScale(.7f);
btnSession.getLabel().setAlignment(Align.center);
menu.row();
menu.add(btnSession).fillX().expand();
menu.add(btnDeleteSession).expand(false, false);
btnSession.addListener(chooseSession(ix));
if (t!=0) {
btnDeleteSession.addListener(deleteSessionConfirm(ix, btnDeleteSession, btnSession));
} else {
btnDeleteSession.setColor(Color.LIGHT_GRAY);
}
}
TextButton btnBack = new TextButton(CLL1.BACKTEXT, skin);
btnBack.getLabel().setFontScale(.7f);
btnBack.pack();
btnBack.addListener(onBack);
menu.row();
menu.add(btnBack).left().fill(false).expand(false, false);
stage.addActor(menu);
}
示例9: LearningSession
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public LearningSession(AbstractGame game, int session, Deck<CardData> masterDeck, Deck<CardData> activeDeck) {
super(game);
this.session = session;
this.masterDeck = masterDeck;
this.activeDeck = activeDeck;
setBackdrop(CLL1.BACKDROP);
setSkin(CLL1.SKIN);
log("Session: " + session);
log("Master Deck Size: " + masterDeck.size());
log("Active Deck Size: " + activeDeck.size());
log("First Time: " + (activeDeck.size() == 0));
stage.addAction(actionUpdateTimeLeft());
lblCountdown = new Label("0:00", skin);
lblCountdown.setFontScale(.75f);
challengeText = new Label("", skin);
choice1 = new Stack();
choice2 = new Stack();
choice1.setTouchable(Touchable.childrenOnly);
choice2.setTouchable(Touchable.childrenOnly);
Gdx.app.postRunnable(init1);
Gdx.app.postRunnable(init2);
Gdx.app.postRunnable(firstPlay);
assets.load(CHECKMARK, Texture.class);
assets.load(XMARK, Texture.class);
assets.finishLoadingAsset(CHECKMARK);
assets.finishLoadingAsset(XMARK);
checkmark = assets.get(CHECKMARK, Texture.class);
xmark = assets.get(XMARK, Texture.class);
imgCheckmark = new Image(checkmark);
imgCheckmark.setScaling(Scaling.fit);
imgCheckmark.setColor(new Color(Color.FOREST));
imgCheckmark.getColor().a = .75f;
imgXmark = new Image(xmark);
imgXmark.setScaling(Scaling.fit);
imgXmark.setColor(new Color(Color.FIREBRICK));
imgXmark.getColor().a = .75f;
assets.load(BUZZER, Sound.class);
assets.load(DING, Sound.class);
}
示例10: SourceImage
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public SourceImage(Pixmap pixmap) {
this.pixmap = pixmap;
image = new Image();
image.setScaling(Scaling.stretch);
addActor(image);
}