本文整理汇总了Java中com.badlogic.gdx.utils.Scaling类的典型用法代码示例。如果您正苦于以下问题:Java Scaling类的具体用法?Java Scaling怎么用?Java Scaling使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scaling类属于com.badlogic.gdx.utils包,在下文中一共展示了Scaling类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:SlotActor.java
示例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);
}
开发者ID:raeleus,项目名称:bobbybird,代码行数:22,代码来源:LoadingState.java
示例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;
}
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:26,代码来源:LearningSession.java
示例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;
}
开发者ID:overengineering,项目名称:space-travels-3,代码行数:23,代码来源:HudScreen.java
示例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();
}
开发者ID:Longri,项目名称:cachebox3.0,代码行数:26,代码来源:SelectDBItem.java
示例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();
}
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:CampPanel.java
示例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);
}
}
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:18,代码来源:ExpandEditTextButton.java
示例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())));
}
}
开发者ID:danirod,项目名称:rectball,代码行数:20,代码来源:BallActor.java
示例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());
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:ImageTextButton.java
示例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);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:ImageScaleTest.java
示例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());
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:ImageTest.java
示例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;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:ViewportTest1.java
示例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;
}
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:23,代码来源:SplashCloudLayer.java
示例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());
}
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:17,代码来源:ProgressDialog.java
示例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);
}
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:18,代码来源:AvatarInfoRow.java
示例16: AnimatedHappyDroid
import com.badlogic.gdx.utils.Scaling; //导入依赖的package包/类
public AnimatedHappyDroid() {
super();
TextureAtlas atlas = TowerAssetManager.textureAtlas("happydroid.txt");
body = new Image(atlas.findRegion("body"));
body.setScaling(Scaling.fill);
leftArm = new Image(atlas.findRegion("left-arm"));
leftArm.setScaling(Scaling.fill);
leftArm.setOrigin(leftArm.getWidth() / 2, 0);
leftArm.setRotation(30f);
leftArm.addAction(forever(sequence(repeat(3, sequence(rotateTo(-15f, 0.2f), rotateTo(45f, 0.2f))), rotateTo(30f), delay(5f)
)));
addActor(body);
addActor(leftArm);
}
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:19,代码来源:AnimatedHappyDroid.java
示例17: addButtonSprite
import com.badlogic.gdx.utils.Scaling; //导入依赖的package包/类
/**
* Adds a button to the menu, with an icon on the left and label on the right.
*/
public Button addButtonSprite(Drawable icon, String label, Runnable action, boolean active) {
LabelStyle style = active ? skin.get(LabelStyle.class) : skin.get("inactive", LabelStyle.class);
Button b = new Button(skin.get(ButtonStyle.class));
if (action != null)
b.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
action.run();
}
});
b.setDisabled(!active);
b.add(new Image(icon, Scaling.fit)).left();
Label l = new Label(label, style);
l.setWrap(true);
b.add(l).padLeft(8).right().expandX().fillX();
table.add(b).minHeight(b.getMinHeight()).prefHeight(b.getPrefHeight()).left().padLeft(1f).colspan(nbColumns);
table.row();
return b;
}
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:27,代码来源:FramedMenu.java
示例18: addLabelSprite
import com.badlogic.gdx.utils.Scaling; //导入依赖的package包/类
/** Adds a label followed by a sprite to the menu. */
public Label addLabelSprite(String label, TextureRegion region, Color color) {
LabelStyle style = skin.get(LabelStyle.class);
Label l = new Label(label, style);
table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());
Image i = new Image(region);
i.setColor(color);
i.setScaling(Scaling.fit);
Cell<Image> right = table.add(i).minHeight(region.getRegionHeight()).prefHeight(region.getRegionHeight()).right();
if (nbColumns > 2)
right.colspan(nbColumns - 1);
table.row();
return l;
}
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:17,代码来源:FramedMenu.java
示例19: setBackgroundTexture
import com.badlogic.gdx.utils.Scaling; //导入依赖的package包/类
/**
* Sets the background texture.
*
* @param textureBackground the texture background
* @param scaling the scaling
* @param fillParent the fill parent
* @param touchable the touchable
*/
public void setBackgroundTexture(TextureRegion textureBackground,
Scaling scaling, boolean fillParent, boolean touchable) {
Drawable tBg = new TextureRegionDrawable(textureBackground);
Image imgbg = new Image(tBg, scaling);
this.imageBackground = imgbg;
imgbg.setFillParent(fillParent);
if (!touchable) {
imgbg.setTouchable(Touchable.disabled);
}
addActor(imgbg);
//
MtxLogger.log(logActive, true, logTag, "World bacground image set");
}
开发者ID:sawankh,项目名称:MathAttack,代码行数:24,代码来源:AbstractWorldScene2d.java
示例20: LootDisplay
import com.badlogic.gdx.utils.Scaling; //导入依赖的package包/类
/**
* Konstruktor.
*
* @param loots
* Alle Loots, die angezeigt werden sllen
* @param lootHeight
* Höhe des Displays
* @param lootWidth
* Breite es Displays
*/
public LootDisplay(final HashSet<Lootable> loots, final int lootHeight,
final int lootWidth) {
// Instanzvariable instazieren
lootList = new ArrayList<Lootable>(loots);
i = 0;
max = lootList.size();
refreshed = false;
setBounds(getX(), getY(), lootWidth, lootHeight);
if (max > 1) {
createArrowButtons();
}
currentImage = new Image();
currentImage.setScaling(Scaling.fit);
addActor(currentImage);
createNameLabel();
addSwipeListener();
}
开发者ID:PhilippGrulich,项目名称:HAW-SE2-projecthorse,代码行数:31,代码来源:LootPopup.java
注:本文中的com.badlogic.gdx.utils.Scaling类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论