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)); }
@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); }
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; }
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; }
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(); }
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(); }
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); } }
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()))); } }
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()); }
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); }
@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()); }
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; }
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; }
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()); }
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); }
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); }
/** * 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; }
/** 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; }
/** * 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"); }
/** * 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(); }
/** * Erzeugt die Elemente für den Namen und das Bild des Loots. * * @param name * Name des Loots * @param img * Bild des Loots */ private void createLabelAndImg(final String name, final Drawable img) { Table table = new Table(); table.setFillParent(true); table.left().top(); table.setBackground(new TextureRegionDrawable(AssetManager .getTextureRegion("ui", "buttonBackground"))); Image icon = new Image(img, Scaling.fit); table.add(icon).height(70).maxWidth(120).pad(15, 0, 15, 0); Label desc = new Label(name, new LabelStyle( AssetManager.getTextFont(FontSize.FORTY), Color.DARK_GRAY)); desc.setEllipse(true); table.add(desc).expandX().left(); addActor(table); }
@Override public void resize(int width, int height) { Vector2 size = Scaling.stretch.apply(WIDTH_VIRTUAL, HEIGHT_VIRTUAL, width, height); viewportX = MathUtils.ceilPositive(width - size.x) / 2; viewportY = MathUtils.ceilPositive(height - size.y) / 2; viewportWidth = MathUtils.floorPositive(size.x); viewportHeight = MathUtils.floorPositive(size.y); Gdx.gl.glViewport(viewportX, viewportY, viewportWidth, viewportHeight); stage.setViewport(WIDTH_VIRTUAL, HEIGHT_VIRTUAL, true, viewportX, viewportY, viewportWidth, viewportHeight); }
private void init (String text) { 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()); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisImageTextButton.this); return false; } }); }
private void init () { image = new Image(); image.setScaling(Scaling.fit); add(image); setSize(getPrefWidth(), getPrefHeight()); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisImageButton.this); return false; } }); updateImage(); }
public AtlasItem (String relativeAtlasPath, AtlasRegion region) { super(VisUI.getSkin()); this.relativeAtlasPath = relativeAtlasPath; this.region = region; assetDescriptor = new AtlasRegionAsset(relativeAtlasPath, region.name); setTouchable(Touchable.enabled); setBackground("menu-bg"); Image img = new Image(region); img.setScaling(Scaling.fit); add(img).expand().fill().row(); VisLabel name = new VisLabel(region.name, "small"); name.setWrap(true); name.setAlignment(Align.center); add(name).expandX().fillX(); }
@Override public void show() { super.show(); Texture splashTexture = new Texture(Gdx.files.internal("data/Splash.png")); Drawable splashDrawable = new TextureRegionDrawable(new TextureRegion(splashTexture)); splashImage = new Image(splashDrawable, Scaling.stretch); splashImage.setFillParent(true); splashImage.getColor().a = 0.0f; splashImage.addAction( sequence(fadeIn(0.75f), delay(2.0f), fadeOut(0.75f), new Action() { @Override public boolean act( float delta ){ game.setScreen(new MenuScreen( game )); return true; } })); stage.addActor(splashImage); }
public MainMenuScreen(GlxyGame gm) { super(gm); logoTex = new Texture(Gdx.files.internal("data/glxy-logo.png")); Image logo = new Image(logoTex); logo.setScaling(Scaling.fit); add(logo); TextButton t = new TextButton("Start!", skin); t.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { game.setScreen("GameScreen"); } }); t.pad(5, 10, 5, 10); add(t).expandY(); Label cpright = new Label( "Copyright CHEKAE 2013 - 2017 - All rights reserved", skin); cpright.setAlignment(Align.center); cpright.setColor(1f, 1f, .8f, 1f); add(cpright).pad(10); }
@Override public void layout() { if (previewFrames != null) { float maxWidth = Float.NEGATIVE_INFINITY; float maxHeight = maxWidth; /* * Array<Frame> frames = previewFrames.getFrames(); for (Frame frame * : frames) { maxWidth = Math.max(maxWidth, frame.getWidth()); * maxHeight = Math.max(maxHeight, frame.getHeight()); } */ Vector2 scale = Scaling.fit.apply(maxWidth, maxHeight, getWidth(), getHeight()); setScale(scale.x / maxWidth); setPosition((getWidth() - scale.x) * .5f, (getHeight() - scale.y) * .5f); } }
public String createThumbnail(String id, Scaling scaling) { ModelEntity scene = new ModelEntity(); Image image = new Image(); image.setUri("map.png"); scene.getComponents().add(image); ModelEntity child = new ModelEntity(); child.setX(200); child.setY(200); child.setRotation(78); image = new Image(); image.setUri("bee.png"); child.getComponents().add(image); scene.getChildren().add(child); controller.getModel().putResource(id, ResourceCategory.SCENE, scene); return Q.getThumbnailPath(scene); /* return Q.getThumbnailPath(scene, 250, 250, scaling).getPath(); */ }
@Override public void update(int screenWidth, int screenHeight, boolean centerCamera) { Vector2 viewFit = Scaling.fit.apply(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), WIDTH, HEIGHT).cpy(); Vector2 viewFill = Scaling.fill.apply(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), WIDTH, HEIGHT); setScreenBounds(0, 0, screenWidth, screenHeight); boolean isPortrait = viewFit.x - WIDTH < 0.1; boolean isLandscape = viewFit.y - HEIGHT < 0.1; offsetX = isLandscape ? viewFill.x / 2 - WIDTH / 2 : 0; offsetY = isPortrait ? viewFill.y / 2 - HEIGHT / 2 : 0; setWorldSize(isLandscape ? viewFill.x : WIDTH, isPortrait ? viewFill.y : HEIGHT); fullWorldWidth = 2 * offsetX + getWorldWidth(); fullWorldHeight = 2 * offsetY + getWorldHeight(); if(offsetX < 0.01) scale = (float)getScreenWidth() / WIDTH; else scale = (float)getScreenHeight() / HEIGHT; apply(centerCamera); }
private void init() { if (progressBarStyle == null) { throw new RuntimeException("ProgressBarItemStyle not set!"); } amountLabel = new Label(labelText(amount), progressBarStyle.labelStyle); amountLabel.pack(); backgroundImage = new Image(progressBarStyle.background); image = createAnimatedImage(progressBarStyle.foreground); if (showLabel) { image.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { amountLabel.setText(labelText(currentAmount)); } }); } backgroundImage.setScaling(Scaling.stretch); image.setScaling(Scaling.stretch); addActor(backgroundImage); addActor(image); }
public MainMenuScreen (LilliGame gm) { super(gm); logoTex = new Texture(Gdx.files.internal("data/logo.png")); Image logo = new Image(logoTex); logo.setScaling(Scaling.fit); add(logo); TextButton t = new TextButton("Start!", skin); t.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { game.setScreen("GameScreen"); } }); t.pad(5, 10, 5, 10); add(t).expandY(); Label cpright = new Label("Copyright KaeruCT 2013 - All rights reserved", skin); cpright.setAlignment(Align.center); cpright.setColor(1f, 1f, .8f, 1f); add(cpright).pad(10); }
@Override public void resize(int width, int height) { super.resize(width, height); Image splashImage = new Image(new SpriteDrawable(new Sprite(splashTexture)), Scaling.stretch, Align.bottom | Align.left); splashImage.setWidth(width); splashImage.setHeight(height); splashImage.getColor().a = 0f; splashImage.addAction(sequence(fadeIn(0.5f), run(new Runnable() { public void run() { game.menuScreen = new MenuScreen(game); } }), delay(1f, fadeOut(0.5f)), run(new Runnable() { public void run() { game.setGameState(GameState.GAME_SHOW_MENU); } }))); stage.addActor(splashImage); }
public BoardImage(final float imageWidth, final float imageHeight, final int nx, final int ny) { setDrawable(new TextureRegionDrawable(FourInALine.Instance.atlas.findRegion("hole"))); this.scaling = Scaling.stretch; this.align = Align.center; this.nx = nx; this.ny = ny; xdim = (int)imageWidth / nx; ydim = (int)imageHeight / ny; setWidth((int)imageWidth); setHeight((int)imageHeight); tile = FourInALine.Instance.atlas.findRegion("hole"); wood = FourInALine.Instance.wood; mask = new TextureRegion(FourInALine.Instance.mask); shader = new ShaderProgram(Gdx.files.internal("shaders/vertex.s"), Gdx.files.internal("shaders/fragment.s")); System.out.println(shader.isCompiled()); System.out.println(shader.getLog()); }
public AvatarView(j paramj, ai paramai, int paramInt, av paramav, Skin paramSkin) { super(paramSkin); this.a = paramSkin; this.b = ((av)an.a(paramav)); this.c = ((AvatarView.AvatarViewStyle)paramSkin.get(AvatarView.AvatarViewStyle.class)); this.l = new i(this.c); this.m = new Image(); this.m.setScaling(Scaling.fill); this.n = new Image(); this.n.setScaling(Scaling.fill); Table localTable = new Table(); Actor[] arrayOfActor1 = new Actor[2]; arrayOfActor1[0] = this.m; arrayOfActor1[1] = this.n; localTable.stack(arrayOfActor1).a(e.a(0.5F)).b(e.b(0.5F)); Actor[] arrayOfActor2 = new Actor[2]; arrayOfActor2[0] = this.l; arrayOfActor2[1] = localTable; stack(arrayOfActor2).n().f(); addListener(new v(this)); a(paramai); a(paramj); a(paramInt); }
public void a(Skin paramSkin, Stage paramStage) { this.d = paramStage; TextButton.TextButtonStyle localTextButtonStyle1 = (TextButton.TextButtonStyle)paramSkin.get("player-compass", TextButton.TextButtonStyle.class); int j = (int)localTextButtonStyle1.font.getSpaceWidth(); this.e = new f("", localTextButtonStyle1); this.e.padLeft(j); this.e.padRight(j); this.e.addListener(new ct(this)); TextButton.TextButtonStyle localTextButtonStyle2 = (TextButton.TextButtonStyle)paramSkin.get("player-compass-clear", TextButton.TextButtonStyle.class); this.f = new f(this.h, localTextButtonStyle2); this.f.padLeft(j); this.f.padRight(j); this.f.setVisible(false); this.f.addListener(new cu(this)); TextureRegion localTextureRegion = paramSkin.getRegion("nav-beacon"); Image localImage = new Image(localTextureRegion); localImage.setScaling(Scaling.none); this.i = new Table(); this.i.add(localImage).b(localTextureRegion.getRegionWidth()).c(localTextureRegion.getRegionHeight()); a(this.a.d()); }
public SplashMenu() { logo = new Image(new TextureRegionDrawable(Assets.getTextureRegion("core:logo.png")), Scaling.fillY, Align.center); text = new Label("Loading " + Branding.DEBUG, new Label.LabelStyle(Fonts.smallHUD, Color.WHITE)); stage.addActor(logo); stage.addActor(text); }
public Group createPuls(float x, float y){ grPuls = new Group(); Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial); Image image = new Image(new TextureRegion(txt)); Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); image.setSize(crop.x * 0.135f, crop.y * 0.135f); image.setPosition(x, y); grPuls.addActor(image); txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable); Image puls = new Image(new TextureRegion(txt)); crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); puls.setSize(1, 1); MoveToAction move = new MoveToAction(); move.setDuration(1); move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f); MoveToAction mo = new MoveToAction(); mo.setDuration(0); mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); ScaleToAction scale = new ScaleToAction(); scale.setScale(WIDTH*0.17f); scale.setDuration(1); ScaleToAction sc = new ScaleToAction(); sc.setDuration(0); sc.setScale(0); RepeatAction repeat = new RepeatAction(); repeat.setCount(RepeatAction.FOREVER); repeat.setAction(new SequenceAction(scale, sc)); puls.addAction(repeat); RepeatAction r = new RepeatAction(); r.setCount(RepeatAction.FOREVER); r.setAction(new SequenceAction(move, mo)); puls.addAction(r); grPuls.addActor(puls); return grPuls; }
private void drawmap() { MapPixmap imageBG = MapPixmap.getInstance(); decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1, 1)))); decalBackground.setPosition(0, 0, 0); decalBackground.setDimensions(800, 800); decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Texture text = null; groupCenter = new Group(); switch (InformationEnklave.getInstance().getFaction()){ case 1:{ text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavered); break; } case 2:{ text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklaveblue); break; } case 3:{ text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavegreen); break; } } Vector2 crop = Scaling.fit.apply(text.getWidth(),text.getHeight(),WIDTH,HEIGHT); Image enklave = new Image(new TextureRegion(text)); enklave.setSize(crop.x*0.6f,crop.y*0.6f); enklave.setPosition(WIDTH / 2 - enklave.getWidth() / 2, HEIGHT / 2 - enklave.getHeight() / 1.7F); groupCenter.addActor(enklave); labelDistance = new Label("Distance: ",new Label.LabelStyle(Font.getFont((int)(HEIGHT*0.025f)),Color.ORANGE)); groupCenter.addActor(labelDistance); }