當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector2f.clone方法代碼示例

本文整理匯總了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;
}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:35,代碼來源:Button.java

示例2: setPropertyValue

import com.jme3.math.Vector2f; //導入方法依賴的package包/類
@Override
@FXThread
protected void setPropertyValue(@Nullable final Vector2f vector) {
    super.setPropertyValue(vector == null ? null : vector.clone());
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:6,代碼來源:Vector2FPropertyControl.java

示例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);

}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:53,代碼來源:Button.java


注:本文中的com.jme3.math.Vector2f.clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。