本文整理汇总了Java中com.jme3.input.event.MouseButtonEvent.getX方法的典型用法代码示例。如果您正苦于以下问题:Java MouseButtonEvent.getX方法的具体用法?Java MouseButtonEvent.getX怎么用?Java MouseButtonEvent.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.MouseButtonEvent
的用法示例。
在下文中一共展示了MouseButtonEvent.getX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMouseButtonEvent
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void onMouseButtonEvent( MouseButtonEvent evt ) {
if( !isEnabled() ) {
return;
}
if( evt.isPressed() ) {
// Save the location for later
clickStart.set(evt.getX(), evt.getY());
} else if( evt.isReleased() ) {
Vector2f click = new Vector2f(evt.getX(), evt.getY());
if( click.distanceSquared(clickStart) < clickRadiusSq ) {
processClickEvent(click, evt);
}
}
}
示例2: MouseUIButtonEvent
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
public MouseUIButtonEvent(MouseButtonEvent originator, E element, int modifiers) {
this(originator.getButtonIndex(), originator.isPressed(), originator.getX(), originator.getY(),
(int) (originator.getX() - (element == null ? 00 : element.getAbsoluteX())),
(int) (originator.getY() - (element == null ? 00 : element.getAbsoluteY())),
element == null ? 1 : element.getScreen().getClickCount(), modifiers, element);
this.originator = originator;
}
示例3: onMouseLeftReleased
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void onMouseLeftReleased(MouseButtonEvent evt) {
boolean hasSubMenu = false;
if (Screen.isAndroid()) {
float x = evt.getX()-getX();
float y = scrollableArea.getAbsoluteHeight()-menuPadding.z-evt.getY();
if (currentMenuItemIndex != (int)Math.floor(y/menuItemHeight)) {
currentMenuItemIndex = (int)Math.floor(y/menuItemHeight);
if (currentMenuItemIndex > -1 && currentMenuItemIndex < menuItems.size()) {
setHighlight(currentMenuItemIndex);
this.hideAllSubmenus(false);
Menu subMenu = menuItems.get(currentMenuItemIndex).getSubMenu();
if (subMenu != null) {
subMenu.showMenu(this, getAbsoluteWidth()-this.menuOverhang, scrollableArea.getAbsoluteHeight()-(menuItemHeight+(currentMenuItemIndex*menuItemHeight))-(subMenu.getHeight()-menuItemHeight));
hasSubMenu = true;
}
}
}
}
if (currentMenuItemIndex > -1 && currentMenuItemIndex < menuItems.size())
this.handleMenuItemClick(menuItems.get(currentMenuItemIndex), currentMenuItemIndex, menuItems.get(currentMenuItemIndex).getValue());
if (!hasSubMenu) {
this.hideAllSubmenus(true);
if (Screen.isAndroid()) screen.handleAndroidMenuState(this);
}
evt.setConsumed();
}