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(); }
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)); }
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; }
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); }
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); }
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)); }
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(); }
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); }
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]); } }
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; }
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); }
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; }
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); }
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]); }
private TiledDrawable getCloud() { Array<String> names = getCore().getImagePacks().get(DATA_PATH + "/clouds"); TiledDrawable tiledDrawable = new TiledDrawable(getCore().getAtlas().findRegion(names.random())); return tiledDrawable; }
private TiledDrawable getBuilding() { Array<String> names = getCore().getImagePacks().get(DATA_PATH + "/buildings"); TiledDrawable tiledDrawable = new TiledDrawable(getCore().getAtlas().findRegion(names.random())); return tiledDrawable; }
private TiledDrawable getGround() { Array<String> names = getCore().getImagePacks().get(DATA_PATH + "/grounds"); TiledDrawable tiledDrawable = new TiledDrawable(getCore().getAtlas().findRegion(names.random())); return tiledDrawable; }
private TiledDrawable getBush() { Array<String> names = getCore().getImagePacks().get(DATA_PATH + "/bushes"); TiledDrawable tiledDrawable = new TiledDrawable(getCore().getAtlas().findRegion(names.random())); return tiledDrawable; }
public static ProgressBar getDelimitedProgressBar(float max, float width) { int delimiterWidth = 1; int chunkWidth = Math.round(width / max); int height = Math.round((Gdx.graphics.getHeight() / 30f)); String progressBarStyleName = String.format("delimitedProgressBar%d/%d/%d", delimiterWidth, chunkWidth, height); if (!skin.has(progressBarStyleName, ProgressBar.ProgressBarStyle.class)) { TiledDrawable backgroundTiledDrawable = getDelimitedTiledDrawableChunk( delimiterWidth, chunkWidth, height, Constants.Visual.DELIMITED_PROGRESSBAR_BACKGROUND, Constants.Visual.DELIMITED_PROGRESSBAR_DELIMITER); TiledDrawable knobBeforeTiledDrawable = getDelimitedTiledDrawableChunk( delimiterWidth, chunkWidth, height, Constants.Visual.DELIMITED_PROGRESSBAR_KNOB_BEFORE, Constants.Visual.DELIMITED_PROGRESSBAR_DELIMITER); ProgressBar.ProgressBarStyle progressBarStyle = new ProgressBar.ProgressBarStyle(); progressBarStyle.background = backgroundTiledDrawable; progressBarStyle.knobBefore = knobBeforeTiledDrawable; progressBarStyle.knobBefore.setMinWidth(0); skin.add(progressBarStyleName, progressBarStyle); } ProgressBar progressBar = new ProgressBar(0, max, 0.01f, false, skin, progressBarStyleName); return progressBar; }
public BusyBar(Style style) { this.style = style; patternDrawable = new TiledDrawable((TextureRegionDrawable) style.pattern); }
@Override public void process(final LmlParser parser, final LmlTag tag, final Image actor, final String rawAttributeData) { Skin skin = parser.getData().getDefaultSkin(); TiledDrawable drawable = skin.getTiledDrawable(parser.parseString(rawAttributeData, actor)); actor.setDrawable(drawable); }
@Override public void process(final LmlParser parser, final LmlTag tag, final Table actor, final String rawAttributeData) { Skin skin = parser.getData().getDefaultSkin(); TiledDrawable drawable = skin.getTiledDrawable(parser.parseString(rawAttributeData, actor)); actor.setBackground(drawable); }
public ScnWidget(Skin skin) { bigFont = skin.get("big-font", BitmapFont.class); defaultFont = skin.get("default-font", BitmapFont.class); setSize(150, 150); tile = new TiledDrawable(Ctx.assetManager.getIcon("transparent-light")); background = skin.getDrawable("background"); faRenderer.setViewport(getWidth(), getHeight()); setLayoutEnabled(true); addListener(inputListner); Ctx.project.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { EditorLogger.debug("ScnWidget Listener: " + e.getPropertyName()); if (e.getPropertyName().equals(Project.NOTIFY_SCENE_SELECTED)) { if (!projectLoadedFlag) setSelectedScene(Ctx.project.getSelectedScene()); } else if (e.getPropertyName().equals(Project.NOTIFY_ACTOR_SELECTED)) { if (!projectLoadedFlag) setSelectedActor(Ctx.project.getSelectedActor()); } else if (e.getPropertyName().equals(Project.NOTIFY_ANIM_SELECTED)) { if (!projectLoadedFlag && Ctx.project.getSelectedFA() != null) setSelectedFA(Ctx.project.getSelectedFA()); } else if (e.getPropertyName().equals(Project.NOTIFY_PROJECT_LOADED)) { projectLoadedFlag = true; } else if (e.getPropertyName().equals("scene")) { setSelectedScene(Ctx.project.getSelectedScene()); setSelectedActor(Ctx.project.getSelectedActor()); } else if (e.getPropertyName().equals("init_animation")) { if (!inScene) setSelectedFA(null); } } }); showWalkZone = Boolean.parseBoolean(Ctx.project.getEditorConfig().getProperty("view.showWalkZone", "false")); inScene = Boolean.parseBoolean(Ctx.project.getEditorConfig().getProperty("view.inScene", "false")); animation = Boolean.parseBoolean(Ctx.project.getEditorConfig().getProperty("view.animation", "true")); }
@Override public void draw(Batch batch, float x1, float y1, float w1, float h1) { int x = (int) x1; int y = (int) y1; int width = (int) w1; int height = (int) h1; if (drawables == null) { drawables = new Drawable[9]; drawables[0] = new TextureRegionDrawable(lt); if (mt != null) drawables[1] = new TiledDrawable(mt); if (rt != null) drawables[2] = new TextureRegionDrawable(rt); if (lm != null) drawables[3] = new TiledDrawable(lm); if (mm != null) drawables[4] = new TiledDrawable(mm); if (rm != null) drawables[5] = new TiledDrawable(rm); if (lb != null) drawables[6] = new TextureRegionDrawable(lb); if (mb != null) drawables[7] = new TiledDrawable(mb); if (rb != null) drawables[8] = new TextureRegionDrawable(rb); } int cw = (int) drawables[0].getMinWidth(); int ch = (int) drawables[0].getMinHeight(); if (width < cw * 2 && width > 0) cw = (int) (width / 2f); if (height < ch * 2 && height > 0) ch = (int) (height / 2f); int mw = width - cw * 2; int mh = height - ch * 2; int sh = (int) (drawables[1] != null ? drawables[1].getMinHeight() : 0); int sw = (int) (drawables[3] != null ? drawables[3].getMinWidth() : 0); int deltaW = Math.max(cw, sw) - Math.min(cw, sw); int deltaH = Math.max(ch, sh) - Math.min(ch, sh); drawables[0].draw(batch, x, y + height - ch, cw, ch); if (drawables[1] != null) drawables[1].draw(batch, x + cw, y + height - sh + (center ? deltaH / 2 : 0), mw, sh); if (drawables[2] != null) drawables[2].draw(batch, x + width - cw, y + height - ch, cw, ch); if (drawables[3] != null) drawables[3].draw(batch, x + (center ? deltaW / 2 : 0), y + ch, sw, mh); if (drawables[4] != null) drawables[4].draw(batch, x + cw, y + ch, mw, mh); if (drawables[5] != null) drawables[5].draw(batch, x + width - sw - (center ? deltaW / 2 : 0), y + ch, sw, mh); if (drawables[6] != null) drawables[6].draw(batch, x, y, cw, ch); if (drawables[7] != null) drawables[7].draw(batch, x + cw, y - (center ? deltaH / 2 : 0), mw, sh); if (drawables[8] != null) drawables[8].draw(batch, x + width - cw, y, cw, ch); }
@Override public TiledDrawable getTiledDrawable(String name) { GUIProfiler.instance().assetAccess(name, TiledDrawable.class); return super.getTiledDrawable(name); }
@Override public void drawTiledDrawable(TiledDrawable tiledDrawable, float x, float y, float width, float height) { }
@Override public void drawTiledDrawable(TiledDrawable tiledDrawable, float x, float y, float width, float height) { beginRendering(); tiledDrawable.draw(spriteBatch, x, y, width, height); }
/** * Draws a {@link TiledDrawable} to screen * * @param tiledDrawable * The {@link TiledDrawable} to be drawn * @param x * The x coordinate to draw at * @param y * The y coordinate to draw at * @param width * The width to render * @param height * The height to render */ public void drawTiledDrawable(TiledDrawable tiledDrawable, float x, float y, float width, float height);