@Override public float getWidth () { return super.getWidth() / region.getRotatedPackedWidth() * region.originalWidth; }
public float getWidthRatio () { return super.getWidth() / region.getRotatedPackedWidth(); }
@Override public float getWidth () { return super.getWidth() / region.getRotatedPackedWidth() * region.originalWidth; }
public float getWidthRatio () { return super.getWidth() / region.getRotatedPackedWidth(); }
public void setSprite (Sprite sprite) { this.sprite = sprite; setMinWidth(sprite.getWidth()); setMinHeight(sprite.getHeight()); }
public void setSprite (Sprite sprite) { this.sprite = sprite; setMinWidth(sprite.getWidth()); setMinHeight(sprite.getHeight()); }
x = editor.renderer.bgImage.getX(); y = editor.renderer.bgImage.getY(); w = editor.renderer.bgImage.getWidth(); h = editor.renderer.bgImage.getHeight();
x = editor.renderer.bgImage.getX(); y = editor.renderer.bgImage.getY(); w = editor.renderer.bgImage.getWidth(); h = editor.renderer.bgImage.getHeight();
private void renderSingleLine () { String text = "Single Line"; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); layout.setText(font, text); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; font.draw(spriteBatch, text, x, y); }
private void renderMultiLine () { String text = "Multi\nLine"; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); layout.setText(font, text); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; font.draw(spriteBatch, text, x, y); // Note that multi line text can be aligned: // font.draw(spriteBatch, text, x, y, width, Align.center, false); }
private void renderWrapped () { String text = "Wrapped Wrapped Wrapped Wrapped"; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); layout.setText(font, text, Color.WHITE, width, Align.left, true); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; font.draw(spriteBatch, text, x, y, width, Align.left, true); // More efficient to draw the layout used for bounds: // font.draw(spriteBatch, layout, x, y); // Note that wrapped text can be aligned: // font.draw(spriteBatch, text, x, y, width, Align.center, true); }
private void renderWrappedCached () { String text = "Wrapped Cached Wrapped Cached"; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); // Obviously you wouldn't set the cache text every frame in real code. GlyphLayout layout = cache.setText(text, 0, 0, width, Align.left, true); // Note that wrapped text can be aligned: // cache.setWrappedText(text, 0, 0, width, HAlignment.CENTER); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; cache.setPosition(x, y); cache.draw(spriteBatch); }
private void renderMultiLineCached () { String text = "Multi Line\nCached"; int lines = 2; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); // Obviously you wouldn't set the cache text every frame in real code. GlyphLayout layout = cache.setText(text, 0, 0); // Note that multi line text can be aligned: // cache.setText(text, 0, 0, width, Align.center, false); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; cache.setPosition(x, y); cache.draw(spriteBatch); }
private void renderSingleLineCached () { String text = "Single Line Cached"; float x = logoSprite.getX(); float y = logoSprite.getY(); float width = logoSprite.getWidth(); float height = logoSprite.getHeight(); // Obviously you wouldn't set the cache text every frame in real code. GlyphLayout layout = cache.setText(text, 0, 0); cache.setColors(Color.BLUE, 1, 4); x += width / 2 - layout.width / 2; y += height / 2 + layout.height / 2; cache.setPosition(x, y); cache.draw(spriteBatch); }
float prevSpriteHeight = particle.getHeight(); particle.setRegion(sprite); particle.setSize(sprite.getWidth(), sprite.getHeight()); particle.setOrigin(sprite.getOriginX(), sprite.getOriginY()); particle.translate((prevSpriteWidth - sprite.getWidth()) / 2, (prevSpriteHeight - sprite.getHeight()) / 2); particle.frame = frame;
float prevSpriteHeight = particle.getHeight(); particle.setRegion(sprite); particle.setSize(sprite.getWidth(), sprite.getHeight()); particle.setOrigin(sprite.getOriginX(), sprite.getOriginY()); particle.translate((prevSpriteWidth - sprite.getWidth()) / 2, (prevSpriteHeight - sprite.getHeight()) / 2); particle.frame = frame;
@Override public void create () { renderer = new ImmediateModeRenderer20(false, false, 0); spriteBatch = new SpriteBatch(); obj = new Sprite(new Texture(Gdx.files.internal("data/badlogicsmall.jpg"))); obj.setSize(40, 40); obj.setOriginCenter(); obj2 = new Sprite(new Texture(Gdx.files.internal("data/bobrgb888-32x32.png"))); obj2.setSize(40, 40); obj2.setOriginCenter(); ZIGZAG_SCALE = Gdx.graphics.getDensity() * 96; // 96DP float w = Gdx.graphics.getWidth() - obj.getWidth(); float h = Gdx.graphics.getHeight() - obj.getHeight(); paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, h))); paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(0, h), new Vector2(w, h))); paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, 0), new Vector2(0, h), new Vector2(w, h))); Vector2 cp[] = new Vector2[] {new Vector2(0, 0), new Vector2(w * 0.25f, h * 0.5f), new Vector2(0, h), new Vector2(w * 0.5f, h * 0.75f), new Vector2(w, h), new Vector2(w * 0.75f, h * 0.5f), new Vector2(w, 0), new Vector2(w * 0.5f, h * 0.25f)}; paths.add(new BSpline<Vector2>(cp, 3, true)); paths.add(new CatmullRomSpline<Vector2>(cp, true)); pathLength = paths.get(currentPath).approxLength(500); avg_speed = speed * pathLength; Gdx.input.setInputProcessor(this); }
float spriteWidth = sprite.getWidth(); float spriteHeight = sprite.getHeight();
float spriteWidth = sprite.getWidth(); float spriteHeight = sprite.getHeight();
public void setSprite (Sprite sprite) { this.sprite = sprite; setMinWidth(sprite.getWidth()); setMinHeight(sprite.getHeight()); }