public TMXProperties putAll(TMXProperties tmx) { ObjectMap<String, Object> data = tmx.properties; for (Entries<String, Object> key = data.iterator(); key.hasNext(); ) { Entry<String, Object> entry = key.next(); properties.put(entry.key, entry.value); } return this; }
public Vector2f getOrigin(String text) { Vector2f result = fontSizes.get(text); if (result == null) { result = new Vector2f(stringWidth(text) / 2f, getHeight() / 2f); fontSizes.put(text, result); } return result; }
private void drawBatchString( float tx, float ty, String text, LColor c, int startIndex, int endIndex) { if (isClose) { return; } if (displays.size > DEFAULT_MAX_CHAR) { displays.clear(); } lazyHashCode = 1; if (c != null) { lazyHashCode = LSystem.unite(lazyHashCode, c.r); lazyHashCode = LSystem.unite(lazyHashCode, c.g); lazyHashCode = LSystem.unite(lazyHashCode, c.b); lazyHashCode = LSystem.unite(lazyHashCode, c.a); } String key = text + lazyHashCode; Display display = displays.get(key); if (display == null) { int x = 0, y = 0; displayList.glBegin(); displayList.setBatchPos(tx, ty); if (c != null) { displayList.setImageColor(c); } CharDef lastCharDef = null; char[] data = text.toCharArray(); for (int i = 0; i < data.length; i++) { int id = data[i]; if (id == '\n') { x = 0; y += getLineHeight(); continue; } if (id >= chars.length) { continue; } CharDef charDef = chars[id]; if (charDef == null) { continue; } if (lastCharDef != null) { x += lastCharDef.getKerning(id); } lastCharDef = charDef; if ((i >= startIndex) && (i <= endIndex)) { charDef.draw(x, y); } x += charDef.advance; } if (c != null) { displayList.setImageColor(LColor.white); } displayList.glEnd(); display = new Display(); display.cache = displayList.newBatchCache(); display.text = text; display.width = 0; display.height = 0; displays.put(key, display); } else if (display.cache != null) { display.cache.x = tx; display.cache.y = ty; displayList.postCache(display.cache); } }
public TMXProperties put(String key, Object value) { properties.put(key, value); return this; }