本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable类的典型用法代码示例。如果您正苦于以下问题:Java TiledDrawable类的具体用法?Java TiledDrawable怎么用?Java TiledDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TiledDrawable类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了TiledDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScrollerPane
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public ScrollerPane(TiledDrawable tiledDrawable, float xSpeed, float ySpeed) {
this.tiledDrawable = tiledDrawable;
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
xPosition = 0.0f;
yPosition = 0.0f;
Image image = new Image(tiledDrawable);
innerTable = new Table();
innerTable.add(image).width(5000);
scrollPane = new ScrollPane(innerTable);
scrollPane.setTouchable(Touchable.disabled);
scrollPane.setSmoothScrolling(false);
this.add(scrollPane).grow();
}
示例2: MenuScreen
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public MenuScreen(MainGameClass game) {
this.game = game;
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json"));
progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class);
TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection"));
tiledDrawable.setMinWidth(0);
progressBarStyle.knobBefore = tiledDrawable;
sliderStyle = skin.get("fancy", Slider.SliderStyle.class);
sliderStyle.knobBefore = tiledDrawable;
layoutTable = new Table();
layoutTable.top();
layoutTable.setFillParent(true);
layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50));
}
示例3: getScrollPaneStyle
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private static ScrollPane.ScrollPaneStyle getScrollPaneStyle()
{
ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle();
TiledDrawable scrollKnob = getTiledDrawable(Color.WHITE);
TiledDrawable scrollBackground = getTiledDrawable(Color.DARK_GRAY);
float size = Constants.Visual.UI.SQRT_PIXELS * 0.01f;
scrollKnob.setMinWidth(size);
scrollBackground.setMinWidth(size);
scrollKnob.setMinHeight(size);
scrollBackground.setMinHeight(size);
scrollPaneStyle.hScrollKnob = scrollKnob;
scrollPaneStyle.vScrollKnob = scrollKnob;
scrollPaneStyle.hScroll = scrollBackground;
scrollPaneStyle.vScroll = scrollBackground;
return scrollPaneStyle;
}
示例4: setupUI
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private void setupUI()
{
Skin skin = assetMgr.get("ui/ui.skin", Skin.class);
TextureAtlas uiAtlas = assetMgr.get("ui/ui.atlas", TextureAtlas.class);
title = new TiledDrawable( uiAtlas.findRegion("title") );
stars = new TiledDrawable( uiAtlas.findRegion("space_background") );
Table mainTable = new Table();
mainTable.setFillParent(true);
mainTable.row().expand().padTop(350f).padLeft(150f).padRight(150f);
createProgressBar(skin, mainTable);
stage.addActor(mainTable);
}
示例5: setupUI
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private void setupUI()
{
Skin skin = assetMgr.get(Env.UI_FOLDER + "/ui.skin", Skin.class);
TextureAtlas uiAtlas = assetMgr.get(Env.UI_FOLDER + "/ui.atlas", TextureAtlas.class);
title = new TiledDrawable( uiAtlas.findRegion("title") );
stars = new TiledDrawable( uiAtlas.findRegion("space_background") );
Table mainTable = new Table();
mainTable.setFillParent(true);
mainTable.row().expand().padTop(350f);
createButtons(skin, mainTable);
stage.addActor(mainTable);
}
示例6: Background
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public Background(AssetManager manager) {
manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
manager.load(TEXTURE_FILENAME, Texture.class);
manager.finishLoading();
texture = manager.get(TEXTURE_FILENAME);
TextureRegion[] frames = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0];
animation = new Animation(0.1f, frames[0], frames[1], frames[2]);
animation.setPlayMode(PlayMode.LOOP);
setWidth(FRAME_WIDTH);
setHeight(FRAME_HEIGHT);
background = new TiledDrawable(animation.getKeyFrame(0f));
}
示例7: WindowTable
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public WindowTable(final MessageStyle style) {
stack(new Table() {
{
if (style.bg != null) {
add(new Table() {
{
setBackground(new TiledDrawable(Drawables.skin(style.bg)));
}
}).expand().fill().pad(3);
}
}
}, new Table() {
{
if (style.frame != null) {
setBackground(Drawables.ninePatch(style.frame));
}
add(content = new Table()).expand().fill();
}
}).expand().fill();
}
示例8: setupPlanets
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private void setupPlanets() {
planetSprites[0] = new Sprite(App.TEXTURES.findRegion("planet01"));
planetSprites[1] = new Sprite(App.TEXTURES.findRegion("planet02"));
planetSprites[2] = new Sprite(App.TEXTURES.findRegion("planet03"));
planetSprites[3] = new Sprite(App.TEXTURES.findRegion("planet04"));
planetSprites[4] = new Sprite(App.TEXTURES.findRegion("planet05"));
planetSprites[5] = new Sprite(App.TEXTURES.findRegion("planet06"));
planetSprites[6] = new Sprite(App.TEXTURES.findRegion("planet07"));
planetSprites[7] = new Sprite(App.TEXTURES.findRegion("planet08"));
planetSprites[8] = new Sprite(App.TEXTURES.findRegion("planet09"));
planetSprites[9] = new Sprite(App.TEXTURES.findRegion("planet10"));
sunSprite = new Sprite(App.TEXTURES.findRegion("sun"));
sunSprite.setPosition(-sunSprite.getWidth() / 2, -sunSprite.getHeight() / 2);
//pointLight = new PointLight[SolarSystem.NUMBER_OF_PLANETS];
for (int i = 0; i < SolarSystem.NUMBER_OF_PLANETS; i++) {
Vector2 position = App.solarSystem.getPlanetPosition(i);
planetSprites[i].setPosition(position.x, position.y);
}
TextureAtlas.AtlasRegion stars = App.TEXTURES.findRegion("stars");
bgTile = new TiledDrawable(stars);
}
示例9: loadTiledDrawables
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private void loadTiledDrawables() {
if(patches[TOP_CENTER] != null) {
topCenter = new TiledDrawable(patches[TOP_CENTER]);
}
if(patches[MIDDLE_LEFT] != null) {
middleLeft = new TiledDrawable(patches[MIDDLE_LEFT]);
}
if(patches[MIDDLE_CENTER] != null) {
middleCenter = new TiledDrawable(patches[MIDDLE_CENTER]);
}
if(patches[MIDDLE_RIGHT] != null) {
middleRight = new TiledDrawable(patches[MIDDLE_RIGHT]);
}
if(patches[BOTTOM_CENTER] != null) {
bottomCenter = new TiledDrawable(patches[BOTTOM_CENTER]);
}
}
示例10: getTiledDrawable
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public TiledDrawable getTiledDrawable(String paramString)
{
TiledDrawable localTiledDrawable1 = (TiledDrawable)optional(paramString, TiledDrawable.class);
if (localTiledDrawable1 != null);
Drawable localDrawable;
do
{
return localTiledDrawable1;
localDrawable = (Drawable)optional(paramString, Drawable.class);
if (localTiledDrawable1 == null)
break;
}
while ((localDrawable instanceof TiledDrawable));
throw new GdxRuntimeException("Drawable found but is not a TiledDrawable: " + paramString + ", " + localDrawable.getClass().getName());
TiledDrawable localTiledDrawable2 = new TiledDrawable(getRegion(paramString));
add(paramString, localTiledDrawable2, TiledDrawable.class);
return localTiledDrawable2;
}
示例11: setBackdrop
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public void setBackdrop(String textureFile) {
if (backdropTextureFile != null) {
assets.unload(backdropTextureFile);
}
backdropTextureFile = textureFile;
assets.load(textureFile, Texture.class);
assets.finishLoadingAsset(textureFile);
Texture texture = assets.get(textureFile, Texture.class);
TiledDrawable tiled = new TiledDrawable(new TextureRegion(texture));
Image img = new Image(tiled);
img.setFillParent(true);
backStage.addActor(img);
}
示例12: getDelimitedTiledDrawableChunk
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private static TiledDrawable getDelimitedTiledDrawableChunk(
int delimiterWidth,
int width,
int height, Color backgroundColor,
Color delimiterColor)
{
Pixmap pixmap = new Pixmap(
width,
height,
Pixmap.Format.RGBA8888);
pixmap.setColor(backgroundColor);
pixmap.fillRectangle(0, 0, pixmap.getWidth() - delimiterWidth, pixmap.getHeight());
pixmap.setColor(delimiterColor);
pixmap.fillRectangle(
pixmap.getWidth() - delimiterWidth,
0,
delimiterWidth,
pixmap.getHeight());
Texture texture = new Texture(pixmap);
pixmap.dispose();
TextureRegion textureRegion = new TextureRegion(texture);
TiledDrawable tiledDrawable = new TiledDrawable(textureRegion);
return tiledDrawable;
}
示例13: ControlsWindow
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public ControlsWindow(String title, Skin skin, Stage ui) {
super(title, skin);
this.setName(title);
this.skin = skin;
this.ui = ui;
/** Global resources **/
TextureRegion septexreg = ((TextureRegionDrawable) skin.newDrawable("separator")).getRegion();
septexreg.getTexture().setWrap(TextureWrap.Repeat, TextureWrap.ClampToEdge);
this.separator = new TiledDrawable(septexreg);
EventManager.instance.subscribe(this, Events.TOGGLE_TIME_CMD, Events.GUI_SCROLL_POSITION_CMD, Events.GUI_FOLD_CMD, Events.GUI_MOVE_CMD, Events.RECALCULATE_OPTIONS_SIZE);
}
示例14: TilesetDrawable
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
public TilesetDrawable(TextureRegion... regions) {
assert (drawables.length == 9);
drawables = new Drawable[9];
drawables[0] = new TextureRegionDrawable(regions[0]);
if (regions[1] != null) drawables[1] = new TiledDrawable(regions[1]);
if (regions[2] != null) drawables[2] = new TextureRegionDrawable(regions[2]);
if (regions[3] != null) drawables[3] = new TiledDrawable(regions[3]);
if (regions[4] != null) drawables[4] = new TiledDrawable(regions[4]);
if (regions[5] != null) drawables[5] = new TiledDrawable(regions[5]);
if (regions[6] != null) drawables[6] = new TextureRegionDrawable(regions[6]);
if (regions[7] != null) drawables[7] = new TiledDrawable(regions[7]);
if (regions[8] != null) drawables[8] = new TextureRegionDrawable(regions[8]);
}
示例15: getCloud
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable; //导入依赖的package包/类
private TiledDrawable getCloud() {
Array<String> names = getCore().getImagePacks().get(DATA_PATH + "/clouds");
TiledDrawable tiledDrawable = new TiledDrawable(getCore().getAtlas().findRegion(names.random()));
return tiledDrawable;
}