本文整理匯總了Java中com.jme3.math.Vector2f.clone方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector2f.clone方法的具體用法?Java Vector2f.clone怎麽用?Java Vector2f.clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.math.Vector2f
的用法示例。
在下文中一共展示了Vector2f.clone方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calcTextOffset
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
@Override
protected Vector4f calcTextOffset(Button element, AnimText textElement, Vector4f textPadding) {
Vector4f off = super.calcTextOffset(element, textElement, textPadding).clone();
Vector2f ip = element.getButtonIcon().calcPreferredSize();
if (element.getButtonIcon().getElementTexture() != null || !Vector2f.ZERO.equals(ip)) {
Vector2f ps = element.getDimensions().clone();
Vector2f sz = ip.clone();
if (Vector2f.ZERO.equals(ip)) {
// Element is as big as we want it
float sc = Math.min(ps.x, ps.y);
sz.x = sc / 2f;
sz.y = sc / 2f;
}
//
if (element.getText() != null && !"".equals(element.getText())) {
switch (element.getButtonIconAlign()) {
case Left:
off.x += sz.x + element.getIndent();
;
break;
case Right:
if (textElement.getTextAlign() != Align.Left)
off.y += sz.x + element.getIndent();
break;
default:
break;
}
}
}
return off;
}
示例2: setPropertyValue
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
@Override
@FXThread
protected void setPropertyValue(@Nullable final Vector2f vector) {
super.setPropertyValue(vector == null ? null : vector.clone());
}
示例3: onLayout
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
@Override
protected void onLayout(Button parent) {
final String text1 = parent.getText();
Vector4f margin = parent.getMargin();
Vector4f textPadding = parent.getAllPadding();
Vector2f dim = parent.getDimensions().subtract(margin.x + margin.y, margin.z + margin.w);
Vector2f ip = parent.getButtonIcon().calcPreferredSize();
if (parent.getButtonIcon().getElementTexture() != null || !Vector2f.ZERO.equals(ip)) {
Vector2f ps = calcTextSize(parent, parent.getWidth() - parent.getTotalPadding().x);
if (ps == null)
ps = Vector2f.ZERO;
Vector2f sz = ip.clone();
if (Vector2f.ZERO.equals(ip)) {
// Element is as big as we want it
float sc = Math.min(ps.x, ps.y);
sz.x = sc / 2f;
sz.y = sc / 2f;
}
Vector2f pos = new Vector2f();
float cx = ((parent.getWidth() - textPadding.x - textPadding.y) / 2f) - (sz.x / 2f) + textPadding.x;
if (text1 == null || text1.equals("")) {
pos.set(cx, (parent.getHeight() / 2f) - (sz.y / 2f));
} else {
switch (parent.getButtonIconAlign()) {
case Left:
pos.set(textPadding.x, (parent.getHeight() / 2f) - (sz.y / 2f));
break;
case Right:
pos.set(parent.getWidth() - sz.x - textPadding.y, (parent.getHeight() / 2) - (sz.y / 2));
break;
default:
switch (parent.getTextVAlign()) {
case Top:
pos.set(cx, parent.getHeight() - sz.y - textPadding.w);
break;
case Bottom:
pos.set(cx, textPadding.z);
break;
default:
pos.set(cx, (parent.getHeight() / 2f) - (sz.y / 2f));
break;
}
break;
}
}
parent.getButtonIcon().setBounds(pos.x, pos.y, sz.x, sz.y);
}
parent.getOverlay().setBounds(margin.x, margin.z, dim.x, dim.y);
}