本文整理匯總了Java中com.badlogic.gdx.utils.Scaling類的典型用法代碼示例。如果您正苦於以下問題:Java Scaling類的具體用法?Java Scaling怎麽用?Java Scaling使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Scaling類屬於com.badlogic.gdx.utils包,在下文中一共展示了Scaling類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SlotActor
import com.badlogic.gdx.utils.Scaling; //導入依賴的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.utils.Scaling; //導入依賴的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.utils.Scaling; //導入依賴的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: createPickupTable
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
private Table createPickupTable()
{
this.pickupTable = new Table();
this.pickupTable
.defaults()
.height(this.stage.getViewport().getScreenWidth() / 30f);
Texture pickupTexture = AssMan.getGameAssMan().get(AssMan.getAssList().pickupGreyTexture);
for (int i = 0; i < this.level.getPickups().size(); i++)
{
Image pickupImage = new Image(pickupTexture);
pickupImage.setScaling(Scaling.fit);
this.grayPickups.add(pickupImage);
this.pickupTable.add(pickupImage);
}
return this.pickupTable;
}
示例5: SelectDBItem
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public SelectDBItem(int listIndex, File file, String fileInfo, SelectDB_Activity.SelectDbStyle style) {
super(listIndex);
Label.LabelStyle nameStyle = new Label.LabelStyle();
nameStyle.font = style.nameFont;
nameStyle.fontColor = style.nameColor;
Label.LabelStyle infoStyle = new Label.LabelStyle();
infoStyle.font = style.infoFont;
infoStyle.fontColor = style.infoColor;
Table infoTable = new VisTable();
fileName = file.getName();
lblName = new VisLabel(fileName, nameStyle);
lblInfo = new VisLabel(fileInfo, infoStyle);
infoTable.add(lblName).left().fillX();
infoTable.row();
infoTable.add(lblInfo).left().fillX();
Image iconImage = new Image(CB.getSkin().getMenuIcon.manageDB, Scaling.none);
this.add(iconImage).center().padRight(CB.scaledSizes.MARGIN_HALF);
this.add(infoTable).expandX().fillX();
}
示例6: rebuild
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
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();
}
示例7: ExpandEditTextButton
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public ExpandEditTextButton(String text, Style style) {
super(style);
this.style = style;
label = new VisLabel(text, style.labelStyle);
label.setAlignment(Align.left);
label.setEllipsis(true);
labelCell = add(label).growX().left().width(new LabelCellWidthValue());
if (style.expandIcon != null) {
Image image = new Image(style.expandIcon);
image.setScaling(Scaling.none);
expandIconCell = add(image).padLeft(4f);
}
}
示例8: BallActor
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public BallActor(BoardActor board, Ball ball, TextureAtlas atlas) {
this.board = board;
this.ball = ball;
this.atlas = atlas;
setScaling(Scaling.fit);
addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
setSelected(!isSelected());
return true;
}
});
grayDrawable = new TextureRegionDrawable(atlas.findRegion("ball_gray"));
colorDrawables = new HashMap<>();
for (BallColor color : BallColor.values()) {
colorDrawables.put(color, new TextureRegionDrawable(atlas.findRegion("ball_" + color.toString().toLowerCase())));
}
}
示例9: ImageTextButton
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public ImageTextButton (String text, ImageTextButtonStyle style) {
super(style);
this.style = style;
defaults().space(3);
image = new Image();
image.setScaling(Scaling.fit);
add(image);
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(label);
setStyle(style);
setSize(getPrefWidth(), getPrefHeight());
}
示例10: create
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public void create () {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
texture = new Texture("data/group-debug.png");
Image image = new Image(texture);
image.setScaling(Scaling.fit);
image.setBounds(100, 100, 400, 200);
stage.addActor(image);
Image image2 = new Image(texture);
image2.setScaling(Scaling.fit);
image.setBounds(100, 100, 400, 200);
image2.setOrigin(200, 100);
image2.setScale(0.5f);
stage.addActor(image2);
}
示例11: create
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
@Override
public void create () {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
image2 = new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg")));
ui = new Stage();
Gdx.input.setInputProcessor(ui);
root = new Table();
root.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
ui.addActor(root);
root.debug();
Image image = new Image(image2);
image.setScaling(Scaling.fill);
root.add(image).width(image2.getRegionWidth()).height(image2.getRegionHeight());
}
示例12: getViewports
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
static public Array<Viewport> getViewports (Camera camera) {
int minWorldWidth = 640;
int minWorldHeight = 480;
int maxWorldWidth = 800;
int maxWorldHeight = 480;
Array<Viewport> viewports = new Array();
viewports.add(new StretchViewport(minWorldWidth, minWorldHeight, camera));
viewports.add(new FillViewport(minWorldWidth, minWorldHeight, camera));
viewports.add(new FitViewport(minWorldWidth, minWorldHeight, camera));
viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, camera));
viewports.add(new ExtendViewport(minWorldWidth, minWorldHeight, maxWorldWidth, maxWorldHeight, camera));
viewports.add(new ScreenViewport(camera));
ScreenViewport screenViewport = new ScreenViewport(camera);
screenViewport.setUnitsPerPixel(0.75f);
viewports.add(screenViewport);
viewports.add(new ScalingViewport(Scaling.none, minWorldWidth, minWorldHeight, camera));
return viewports;
}
示例13: spawnCloudNow
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
protected Image spawnCloudNow(boolean spawnOnScreen) {
if (worldSize.x == 0 || worldSize.y == 0) {
return null;
}
final Image cloud = new Image(Iterables.get(cloudRegions, MathUtils.random(cloudRegions.size - 1)));
cloud.setScaling(Scaling.fit);
cloud.setHeight(Math.min(cloud.getHeight(), getStage().getHeight() * 0.18f));
if (spawnOnScreen) {
cloud.setX(Random.randomInt(0, worldSize.x));
cloud.setY(Random.randomInt(worldSize.y * CLOUD_SPAWN_MIN, worldSize.y * CLOUD_SPAWN_MAX));
} else {
cloud.setX(-cloud.getWidth());
cloud.setY(Random.randomInt(worldSize.y * CLOUD_SPAWN_MIN, worldSize.y * CLOUD_SPAWN_MAX));
}
cloud.getColor().a = 0f;
cloud.addAction(makeFlyAction(cloud));
addActor(cloud);
return cloud;
}
示例14: ProgressDialog
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public ProgressDialog() {
super();
ResolutionIndependentAtlas resolutionIndependentAtlas = new ResolutionIndependentAtlas(Gdx.files.internal("hud/skin.txt"));
Image progressSpinner = new Image(new TextureRegionDrawable(resolutionIndependentAtlas.findRegion("progress-indeterminate")), Scaling.none);
progressSpinner.layout();
progressSpinner.setOriginX(progressSpinner.getImageWidth() / 2);
progressSpinner.setOriginY(progressSpinner.getImageHeight() / 2);
Table c = new Table();
c.add(progressSpinner).fill();
setView(c);
Tween.to(progressSpinner, WidgetAccessor.ROTATION, 1000).target(-360.0f).repeat(Tween.INFINITY, 350).start(TweenSystem.manager());
}
示例15: AvatarInfoRow
import com.badlogic.gdx.utils.Scaling; //導入依賴的package包/類
public AvatarInfoRow(Avatar avatar) {
super();
this.avatar = avatar;
hungerBar = new ProgressBar((int) (avatar.getHungerLevel() * 100));
restaurantsSatsifaction = new ProgressBar((int) (avatar.getSatisfactionFood() * 100));
movingToLabel = FontManager.Roboto12.makeLabel("");
row().fillX().space(Display.devicePixel(8));
Image avatarImage = new Image(new TextureRegionDrawable(avatar), Scaling.none);
avatarImage.setColor(avatar.getColor());
add(avatarImage);
add(FontManager.Default.makeLabel(avatar.getName())).expandX();
add(hungerBar);
add(restaurantsSatsifaction);
add(movingToLabel).width(200);
}