/** Returns a new or existing pool for the specified type, stored in a Class to {@link Pool} map. The max size of the pool used * is 100. */ static public <T> Pool<T> get (Class<T> type) { return get(type, 100); }
/** Returns a new or existing pool for the specified type, stored in a Class to {@link Pool} map. The max size of the pool used * is 100. */ static public <T> Pool<T> get (Class<T> type) { return get(type, 100); }
/** Obtains an object from the {@link #get(Class) pool}. */ static public <T> T obtain (Class<T> type) { return get(type).obtain(); }
/** Obtains an object from the {@link #get(Class) pool}. */ static public <T> T obtain (Class<T> type) { return get(type).obtain(); }
/** Returns a new or pooled action of the specified type. */ static public <T extends Action> T action (Class<T> type) { Pool<T> pool = Pools.get(type); T action = pool.obtain(); action.setPool(pool); return action; }
/** Returns a new or pooled action of the specified type. */ static public <T extends Action> T action (Class<T> type) { Pool<T> pool = Pools.get(type); T action = pool.obtain(); action.setPool(pool); return action; }
public void reset () { Pools.get(GlyphRun.class).freeAll(runs); runs.clear(); width = 0; height = 0; }
public void reset () { Pools.get(GlyphRun.class).freeAll(runs); runs.clear(); width = 0; height = 0; }
int lastSpace = 0; char lastCharacter; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < text.length(); i++) {
int lastSpace = 0; char lastCharacter; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < text.length(); i++) {
@Override public void layout () { Drawable bg = style.background; BitmapFont font = style.font; if (bg != null) { prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2, bg.getMinHeight()); } else prefHeight = font.getCapHeight() - font.getDescent() * 2; float maxItemWidth = 0; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < items.size; i++) { layout.setText(font, toString(items.get(i))); maxItemWidth = Math.max(layout.width, maxItemWidth); } layoutPool.free(layout); prefWidth = maxItemWidth; if (bg != null) prefWidth += bg.getLeftWidth() + bg.getRightWidth(); ListStyle listStyle = style.listStyle; ScrollPaneStyle scrollStyle = style.scrollStyle; float listWidth = maxItemWidth + listStyle.selection.getLeftWidth() + listStyle.selection.getRightWidth(); if (scrollStyle.background != null) listWidth += scrollStyle.background.getLeftWidth() + scrollStyle.background.getRightWidth(); if (selectBoxList == null || !selectBoxList.disableY) listWidth += Math.max(style.scrollStyle.vScroll != null ? style.scrollStyle.vScroll.getMinWidth() : 0, style.scrollStyle.vScrollKnob != null ? style.scrollStyle.vScrollKnob.getMinWidth() : 0); prefWidth = Math.max(prefWidth, listWidth); }
@Override public void layout () { Drawable bg = style.background; BitmapFont font = style.font; if (bg != null) { prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2, bg.getMinHeight()); } else prefHeight = font.getCapHeight() - font.getDescent() * 2; float maxItemWidth = 0; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < items.size; i++) { layout.setText(font, toString(items.get(i))); maxItemWidth = Math.max(layout.width, maxItemWidth); } layoutPool.free(layout); prefWidth = maxItemWidth; if (bg != null) prefWidth += bg.getLeftWidth() + bg.getRightWidth(); ListStyle listStyle = style.listStyle; ScrollPaneStyle scrollStyle = style.scrollStyle; float listWidth = maxItemWidth + listStyle.selection.getLeftWidth() + listStyle.selection.getRightWidth(); if (scrollStyle.background != null) listWidth += scrollStyle.background.getLeftWidth() + scrollStyle.background.getRightWidth(); if (selectBoxList == null || !selectBoxList.disableY) listWidth += Math.max(style.scrollStyle.vScroll != null ? style.scrollStyle.vScroll.getMinWidth() : 0, style.scrollStyle.vScrollKnob != null ? style.scrollStyle.vScrollKnob.getMinWidth() : 0); prefWidth = Math.max(prefWidth, listWidth); }
public void layout () { BitmapFont font = style.font; Drawable selectedDrawable = style.selection; itemHeight = font.getCapHeight() - font.getDescent() * 2; itemHeight += selectedDrawable.getTopHeight() + selectedDrawable.getBottomHeight(); prefWidth = 0; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < items.size; i++) { layout.setText(font, toString(items.get(i))); prefWidth = Math.max(layout.width, prefWidth); } layoutPool.free(layout); prefWidth += selectedDrawable.getLeftWidth() + selectedDrawable.getRightWidth(); prefHeight = items.size * itemHeight; Drawable background = style.background; if (background != null) { prefWidth += background.getLeftWidth() + background.getRightWidth(); prefHeight += background.getTopHeight() + background.getBottomHeight(); } }
public void layout () { BitmapFont font = style.font; Drawable selectedDrawable = style.selection; itemHeight = font.getCapHeight() - font.getDescent() * 2; itemHeight += selectedDrawable.getTopHeight() + selectedDrawable.getBottomHeight(); prefWidth = 0; Pool<GlyphLayout> layoutPool = Pools.get(GlyphLayout.class); GlyphLayout layout = layoutPool.obtain(); for (int i = 0; i < items.size; i++) { layout.setText(font, toString(items.get(i))); prefWidth = Math.max(layout.width, prefWidth); } layoutPool.free(layout); prefWidth += selectedDrawable.getLeftWidth() + selectedDrawable.getRightWidth(); prefHeight = items.size * itemHeight; Drawable background = style.background; if (background != null) { prefWidth += background.getLeftWidth() + background.getRightWidth(); prefHeight += background.getTopHeight() + background.getBottomHeight(); } }
/** Returns a new or existing pool for the specified type, stored in a Class to {@link Pool} map. The max size of the pool used * is 100. */ static public <T> Pool<T> get (Class<T> type) { return get(type, 100); }
/** Returns a new or pooled action of the specified type. */ static public <T extends Action> T action (Class<T> type) { Pool<T> pool = Pools.get(type); T action = pool.obtain(); action.setPool(pool); return action; }
public void reset () { Pools.get(GlyphRun.class).freeAll(runs); runs.clear(); width = 0; height = 0; }
/** * Returns a new or pooled action of the specified type. */ public static <T extends Operation> T prepare(Class<T> type) { final Pool<T> pool = Pools.get(type); T node = pool.obtain(); node.setPool(pool); return node; }