protected float getJustificationXOffset(final int lineIndex) { float cursorX = 0; switch (_justify) { case Left: cursorX = 0; break; case Center: cursorX = 0.5f * (_size.getXf() - _lineWidths[lineIndex]); break; case Right: cursorX = _size.getXf() - _lineWidths[lineIndex]; break; } return cursorX; }
protected float getJustificationXOffset(final int lineIndex) { float cursorX = 0; switch (_justify) { case Left: cursorX = 0; break; case Center: cursorX = 0.5f * (_size.getXf() - _lineWidths[lineIndex]); break; case Right: cursorX = _size.getXf() - _lineWidths[lineIndex]; break; } return cursorX; }
/** get width in world units */ public float getWidth() { return (_size.getXf() * _worldTransform.getScale().getXf()); }
/** get width in world units */ public float getWidth() { return (_size.getXf() * _worldTransform.getScale().getXf()); }
/** * Sets the correct texture array for the box. */ private void setTextureData() { if (_meshData.getTextureBuffer(0) == null) { _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(24), 0); for (int x = 0; x < 6; x++) { _meshData.getTextureCoords(0).getBuffer().put(_texTopRight.getXf()).put(_texTopRight.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texTopLeft.getXf()).put(_texTopLeft.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texBotLeft.getXf()).put(_texBotLeft.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texBotRight.getXf()).put(_texBotRight.getYf()); } } }
/** * Sets the correct texture array for the box. */ private void setTextureData() { if (_meshData.getTextureBuffer(0) == null) { _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(24), 0); for (int x = 0; x < 6; x++) { _meshData.getTextureCoords(0).getBuffer().put(_texTopRight.getXf()).put(_texTopRight.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texTopLeft.getXf()).put(_texTopLeft.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texBotLeft.getXf()).put(_texBotLeft.getYf()); _meshData.getTextureCoords(0).getBuffer().put(_texBotRight.getXf()).put(_texBotRight.getYf()); } } }
float t, b, l, r; float alignX = _size.getXf() * _align.horizontal; float alignY = _size.getYf() * _align.vertical; alignX = Math.round(alignX);
float t, b, l, r; float alignX = _size.getXf() * _align.horizontal; float alignY = _size.getYf() * _align.vertical; alignX = Math.round(alignX);
/** * Set the position of the text caret as an index to the current set text string. If the specified position is after * the last possible index, it is set to the last possible index. * * @param index * the new position */ public int setCaretPosition(int index) { final String text = getText(); if (text == null) { index = 0; } else if (index > text.length()) { index = text.length(); } if (index < 0) { index = 0; } _caretPosition = index; if (_uiText != null) { _uiText.findCaretTranslation(index, _caretLoc); getCaret().setPosX(Math.round(_caretLoc.getXf())); getCaret().setPosY(Math.round(_caretLoc.getYf())); } else { getCaret().setPosX(0); getCaret().setPosY(0); } return _caretPosition; }
@Override public int setCaretPosition(final int index) { super.setCaretPosition(index); if (_uiText != null) { _uiText.findCaretTranslation(getCaretPosition(), _caretLoc); getCaret().setPosX(Math.round(_caretLoc.getXf())); getCaret().setPosY(Math.round(_caretLoc.getYf())); } else { getCaret().setPosX(0); getCaret().setPosY(0); } return _caretPosition; }
if (value instanceof Vector2) { final Vector2 vec = (Vector2) value; return stack.mallocFloat(2).put(vec.getXf()).put(vec.getYf()).flip();
assertTrue(vec1.getXf() == (float) Math.PI); assertTrue(vec1.getYf() == (float) Math.PI);