本文整理匯總了Java中com.jme3.math.Vector2f.ZERO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Vector2f.ZERO屬性的具體用法?Java Vector2f.ZERO怎麽用?Java Vector2f.ZERO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.jme3.math.Vector2f
的用法示例。
在下文中一共展示了Vector2f.ZERO屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateVector
/**
* Update the vector.
*
* @param event the event
*/
@FXThread
private void updateVector(@Nullable final KeyEvent event) {
if (isIgnoreListener() || (event != null && event.getCode() != KeyCode.ENTER)) return;
final FloatTextField xField = getXField();
final float x = xField.getValue();
final FloatTextField yField = getYField();
final float y = yField.getValue();
final Vector2f oldValue = getPropertyValue() == null ? Vector2f.ZERO : getPropertyValue();
final Vector2f newValue = new Vector2f();
newValue.set(checkResultXValue(x, y), checkResultYValue(x, y));
changed(newValue, oldValue.clone());
}
示例2: modsTab
private void modsTab(IconTabControl tabs) {
XTabPanelContent el = new XTabPanelContent(screen, "ModsContainer", LUtil.LAYOUT_SIZE);
el.setIsMovable(false);
el.setIsResizable(false);
el.setLayoutManager(new MigLayout(screen, "gap 0, ins 0", "push[]push", "push[]push"));
Container modsPanel = new Container(screen, "ModsPanel", Vector2f.ZERO,
screen.getStyle("Mods").getVector2f("defaultSize"), Vector4f.ZERO, null);
modsPanel.setLayoutManager(new MigLayout(screen, "wrap 2, gap 1, fill", "[grow, align left][grow, align left]", "push[][][][][][][][][][][][][][]push"));
el.addChild(modsPanel);
attackSpeedMod = addModLabel(modsPanel, "Attack:", inventoryAndEquipment.getAttackSpeedMod());
blockMod = addModLabel(modsPanel, "Block :", inventoryAndEquipment.getBlockMod());
castSpeedMod = addModLabel(modsPanel, "Cast :", inventoryAndEquipment.getCastSpeedMod());
healingMod = addModLabel(modsPanel, "Healing :", inventoryAndEquipment.getHealingMod());
magicCritMod = addModLabel(modsPanel, "Magic Crit:", inventoryAndEquipment.getMagicCritMod());
magicHitMod = addModLabel(modsPanel, "Magic Hit:", inventoryAndEquipment.getMagicHitMod());
meleeCritMod = addModLabel(modsPanel, "Melee Crit:", inventoryAndEquipment.getMeleeCritMod());
meleeHitMod = addModLabel(modsPanel, "Melee Hit:", inventoryAndEquipment.getMeleeHitMod());
parryMod = addModLabel(modsPanel, "Parry:", inventoryAndEquipment.getParryMod());
regenerationMod = addModLabel(modsPanel, "Regeneration:", inventoryAndEquipment.getRegenHealthMod());
runSpeedMod = addModLabel(modsPanel, "Run:", inventoryAndEquipment.getRunSpeedMod());
tabs.addTabWithIcon("Stat modifiers", screen.getStyle("IconTab").getString("modImg"));
tabs.addTabChild(2, el);
}
示例3: showLinksMenu
protected void showLinksMenu(List<String> urls) {
Menu subMenu = new Menu(screen, Vector2f.ZERO, false) {
@Override
public void onMenuItemClicked(int index, Object value, boolean isToggled) {
try {
XDesktop d = XDesktop.getDesktop();
d.browse(new URI(value.toString()));
} catch (Exception e) {
LOG.log(Level.SEVERE, "Could not open site.", e);
stateManager.getState(HUDMessageAppState.class).message(Level.SEVERE, "Failed to open site. " + e.getMessage());
}
}
};
for (String url : urls) {
subMenu.addMenuItem(url, url, null);
}
// Show menu
screen.addElement(subMenu);
Vector2f xy = screen.getMouseXY();
subMenu.showMenu(null, xy.x, xy.y - subMenu.getHeight());
}
示例4: createSpeechBubble
private Element createSpeechBubble(String text, final ChannelType channel) {
Element el = new Element(screen, UIDUtil.getUID(), Vector2f.ZERO,
screen.getStyle("SpeechBubble").getVector2f("defaultSize"),
screen.getStyle("SpeechBubble").getVector4f("resizeBorders"),
screen.getStyle("SpeechBubble").getString("defaultImg")) {
{
LUtil.removeEffects(this);
populateEffects("SpeechBubble");
}
};
el.setTextWrap(LineWrapMode.Word);
el.setTextAlign(BitmapFont.Align.Center);
el.setTextVAlign(BitmapFont.VAlign.Center);
el.setFont(screen.getStyle("Font").getString(screen.getStyle("SpeechBubble").getString("fontName")));
el.setFontSize(screen.getStyle("SpeechBubble").getFloat("fontSize"));
el.setClipPadding(screen.getStyle("SpeechBubble").getFloat("clipPadding"));
el.setFontColor(UIUtil.fromColorString(
Config.get().node(Config.CHAT_CHANNELS).node(channel.name()).get("color", Icelib.toHexString(channel.getColor()))));
el.setText(text);
return el;
}
示例5: TableRow
public TableRow(BaseScreen screen, Table table, Object value) {
super(screen, null, Vector2f.ZERO, null);
layoutManager = new RowLayout();
this.value = value;
this.table = table;
setMouseFocusable(true);
setIgnoreMouseButtons(false);
setIgnoreTouch(false);
addClippingLayer(table.viewPortClipLayer, null);
addMouseButtonListener(evt -> {
if ((evt.isLeft() || (table.selectOnRightClick && evt.isRight())) && evt.isPressed())
onMouseSelect(evt);
});
}
示例6: reload
@Override
@FXThread
protected void reload() {
final Vector2f vector = getPropertyValue() == null ? Vector2f.ZERO : getPropertyValue();
final FloatTextField xField = getXField();
xField.setValue(vector.getX());
xField.positionCaret(xField.getText().length());
final FloatTextField yField = getYField();
yField.setValue(vector.getY());
yField.positionCaret(yField.getText().length());
}
示例7: initialize
@Override
public void initialize(ElementParticle particle) {
if (isEnabled) {
if (direction != Vector2f.ZERO) {
temp.set(direction.normalize()).multLocal(particle.randforce*strength);
particle.velocity.interpolate(particle.velocity, temp, 0.5f);
}
}
}
示例8: createDirectionButton
private void createDirectionButton(Element container, String positionStyle, String text) {
Label b = new Label(screen, UIDUtil.getUID(), Vector2f.ZERO, screen.getStyle("Minimap").getVector2f("directionButtonSize"),
screen.getStyle("Minimap").getVector4f("directionButtonResizeBorders"), screen.getStyle("Minimap").getString(
"directionButtonImg"));
b.setText(text);
b.setFont(screen.getStyle("Font").getString(screen.getStyle("Minimap").getString("directionButtonFontName")));
b.setFontSize(screen.getStyle("Minimap").getFloat("directionButtonFontSize"));
b.setFontColor(screen.getStyle("Minimap").getColorRGBA("directionButtonFontColor"));
b.setTextAlign(BitmapFont.Align.Center);
b.setTextVAlign(BitmapFont.VAlign.Center);
b.setTextPadding(2);
container.addChild(b, screen.getStyle("Minimap").getVector2f(positionStyle));
}
示例9: update
@Override
public void update(ElementParticle p, float tpf) {
if (isEnabled) {
if (destination != Vector2f.ZERO) {
temp.set(p.initialPosition);
temp2.set(destination).subtractLocal(p.particle.getOrigin());
temp.interpolate(temp2, p.blend);
p.position.interpolate(temp, strength);
}
}
}
示例10: PhysicsCharacterMovement
public PhysicsCharacterMovement() {
this(Vector2f.ZERO);
}
示例11: clearValue
public void clearValue(){
updateNeeded = true;
if (multiData != null){
ZERO_BUF.clear();
multiData.clear();
while (multiData.remaining() > 0){
ZERO_BUF.limit( Math.min(multiData.remaining(), 16) );
multiData.put(ZERO_BUF);
}
multiData.clear();
return;
}
if (varType == null)
return;
switch (varType){
case Int:
this.value = ZERO_INT;
break;
case Boolean:
this.value = Boolean.FALSE;
break;
case Float:
this.value = ZERO_FLT;
break;
case Vector2:
this.value = Vector2f.ZERO;
break;
case Vector3:
this.value = Vector3f.ZERO;
break;
case Vector4:
if (this.value instanceof ColorRGBA){
this.value = ColorRGBA.BlackNoAlpha;
}else{
this.value = Quaternion.ZERO;
}
break;
default:
break; // won't happen because those are either textures
// or multidata types
}
}
示例12: BaseElement
public BaseElement(BaseScreen screen, String styleId, Size dimensions) {
this(screen, styleId, Vector2f.ZERO, dimensions, null, null);
}
示例13: Panel
public Panel(BaseScreen screen, String UID) {
this(screen, UID, Vector2f.ZERO);
}
示例14: onLayout
@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);
}
示例15: getAbsolute
@Override
public Vector2f getAbsolute() {
return Vector2f.ZERO;
}