/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (Color tint) { setColors(tint.toFloatBits()); }
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (float r, float g, float b, float a) { int intBits = ((int)(255 * a) << 24) | ((int)(255 * b) << 16) | ((int)(255 * g) << 8) | ((int)(255 * r)); setColors(NumberUtils.intToFloatColor(intBits)); }
/** Sets the color of the specified characters. This may only be called after {@link #setText(CharSequence, float, float)} and * is reset every time setText is called. */ public void setColors (Color tint, int start, int end) { setColors(tint.toFloatBits(), start, end); }
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (float r, float g, float b, float a) { int intBits = ((int)(255 * a) << 24) | ((int)(255 * b) << 16) | ((int)(255 * g) << 8) | ((int)(255 * r)); setColors(NumberUtils.intToFloatColor(intBits)); }
/** Sets the color of the specified characters. This may only be called after {@link #setText(CharSequence, float, float)} and * is reset every time setText is called. */ public void setColors (Color tint, int start, int end) { setColors(tint.toFloatBits(), start, end); }
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (Color tint) { setColors(tint.toFloatBits()); }
private void renderCached () { cache5.setColors(red); cache5.draw(spriteBatch); cache1.draw(spriteBatch); if (red.a > 0.6f) return; cache2.draw(spriteBatch); cache3.draw(spriteBatch); cache4.draw(spriteBatch); }
private void renderCachedScaled () { cacheScaled5.setColors(red); cacheScaled5.draw(spriteBatch); cacheScaled1.draw(spriteBatch); if (red.a > 0.6f) return; cacheScaled2.draw(spriteBatch); cacheScaled3.draw(spriteBatch); cacheScaled4.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); }
/** Sets the color of the specified characters. This may only be called after {@link #setText(CharSequence, float, float)} and * is reset every time setText is called. */ public void setColors (Color tint, int start, int end) { setColors(tint.toFloatBits(), start, end); }
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (float r, float g, float b, float a) { int intBits = ((int)(255 * a) << 24) | ((int)(255 * b) << 16) | ((int)(255 * g) << 8) | ((int)(255 * r)); setColors(NumberUtils.intToFloatColor(intBits)); }
/** Sets the color of all text currently in the cache. Does not affect subsequently added text. */ public void setColors (Color tint) { setColors(tint.toFloatBits()); }
@Override protected void drawBackground (Batch batch, float parentAlpha, float x, float y) { float width = getWidth(), height = getHeight(); float padTop = getPadTop(); super.drawBackground(batch, parentAlpha, x, y); // Draw button table. buttonTable.getColor().a = getColor().a; buttonTable.pack(); buttonTable.setPosition(width - buttonTable.getWidth(), Math.min(height - padTop, height - buttonTable.getHeight())); buttonTable.draw(batch, parentAlpha); // Draw the title without the batch transformed or clipping applied. y += height; TextBounds bounds = titleCache.getBounds(); if ((titleAlignment & Align.left) != 0) x += getPadLeft(); else if ((titleAlignment & Align.right) != 0) x += width - bounds.width - getPadRight(); else x += (width - bounds.width) / 2; if ((titleAlignment & Align.top) == 0) { if ((titleAlignment & Align.bottom) != 0) y -= padTop - bounds.height; else y -= (padTop - bounds.height) / 2; } titleCache.setColors(tmpColor.set(getColor()).mul(style.titleFontColor)); titleCache.setPosition((int)x, (int)y - 15); // HACK for Kenney's skin only!! titleCache.draw(batch, parentAlpha); }