MCPcopy Create free account
hub / github.com/Var3D/var3dframe / drawLabel

Method drawLabel

core/src/core/java/var3d/net/center/VLabel.java:208–231  ·  view source on GitHub ↗
(Batch batch, float parentAlpha)

Source from the content-addressed store, hash-verified

206
207
208 public void drawLabel(Batch batch, float parentAlpha) {
209 validate();
210 if (getStyle().background != null) {
211 batch.setColor(1, 1, 1, getColor().a);
212 float padding = getHeight() * 0.15f;
213 float paddingX = getStyle().font.getSpaceWidth() * 0.5f;
214 getStyle().background.draw(batch, getX() - paddingX, getY(), getWidth() + paddingX * 2, getHeight() + padding);
215 }
216 if (isStroke) {
217 strokeColor.a = getColor().a;
218 fontCache.tint(strokeColor);
219 for (int i = 0; i < dxs.length; i++) {
220 fontCache.setPosition(getX() + dxs[i] * strokeWidth, getY() + dys[i] * strokeWidth + strokeWidth);
221 fontCache.draw(batch);
222 }
223 fontCache.setPosition(getX(), getY() + strokeWidth);
224 fontCache.tint(getColor());
225 fontCache.draw(batch);
226 } else {
227 fontCache.setPosition(getX(), getY() + strokeWidth);
228 fontCache.tint(getColor());
229 fontCache.draw(batch);
230 }
231 }
232}

Callers 1

drawMethod · 0.95

Calls 4

setPositionMethod · 0.80
setColorMethod · 0.45
getColorMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected