本文整理汇总了Java中com.jme3.input.event.MouseButtonEvent.isPressed方法的典型用法代码示例。如果您正苦于以下问题:Java MouseButtonEvent.isPressed方法的具体用法?Java MouseButtonEvent.isPressed怎么用?Java MouseButtonEvent.isPressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.MouseButtonEvent
的用法示例。
在下文中一共展示了MouseButtonEvent.isPressed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onMouseButtonEventQueued
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
buttonIndex = evt.getButtonIndex();
pressed = evt.isPressed();
if (nic.processMouseEvent(x, y, 0, buttonIndex, pressed)){
evt.setConsumed();
}
}
示例3: 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;
}
示例4: mouseButtonEvent
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void mouseButtonEvent( MouseButtonEvent event, Spatial target, Spatial capture ) {
// Buttons always consume their click events
event.setConsumed();
// Do our own better handling of 'click' now
//super.mouseButtonEvent(event, target, capture);
if( !isEnabled() )
return;
if( event.isPressed() ) {
setPressed(event.isPressed());
} else if( isPressed() ) {
// Only run the up processing if we were already pressed
// This also handles the case where we weren't enabled before
// but are now, etc.
if( target == capture ) {
// Then we are still over the button and we should run the
// click
runClick();
}
// If we run the up without checking properly then we
// potentially get up events with no down event. This messes
// up listeners that are (correctly) expecting an up for every
// down and no ups without downs.
// So, any time the capture is us then we will run, else not
if( capture == Button.this ) {
setPressed(false);
}
}
}
示例5: onMouseButtonEvent
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void onMouseButtonEvent(MouseButtonEvent evt) {
if (evt.isReleased()) {
currentTool.onMouseButtonReleased(this);
} else if (evt.isPressed()) {
currentTool.onMouseButtonPressed(this);
}
}
示例6: onMouseButtonEventQueued
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
boolean wasPressed = pressed;
boolean forwardToNifty = true;
buttonIndex = evt.getButtonIndex();
pressed = evt.isPressed();
// Mouse button raised. End dragging
if (wasPressed && !pressed){
if (!niftyOwnsDragging){
forwardToNifty = false;
}
isDragging = false;
niftyOwnsDragging = false;
}
boolean consumed = false;
if (forwardToNifty){
consumed = nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
if (consumed){
evt.setConsumed();
}
}
// Mouse button pressed. Begin dragging
if (!wasPressed && pressed){
isDragging = true;
niftyOwnsDragging = consumed;
}
}
示例7: s3dOnMouseButtonEvent
import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void s3dOnMouseButtonEvent(MouseButtonEvent evt) {
float x = Screen.isAndroid() ? touchXY.x : mouseXY.x;
float y = Screen.isAndroid() ? touchXY.y : mouseXY.y;
eventNode = getEventNode(x, y);
if (eventNode != null) {
if (evt.isPressed()) {
switch (evt.getButtonIndex()) {
case 0:
if (eventNode instanceof MouseButtonListener) {
((MouseButtonListener)eventNode).onMouseLeftPressed(evt);
}
break;
case 1:
if (eventNode instanceof MouseButtonListener) {
((MouseButtonListener)eventNode).onMouseRightPressed(evt);
}
break;
case 2:
if (eventNode instanceof MouseWheelListener) {
((MouseWheelListener)eventNode).onMouseWheelPressed(evt);
}
break;
}
} else if (evt.isReleased()) {
switch (evt.getButtonIndex()) {
case 0:
if (eventNode instanceof MouseButtonListener) {
((MouseButtonListener)eventNode).onMouseLeftReleased(evt);
}
break;
case 1:
if (eventNode instanceof MouseButtonListener) {
((MouseButtonListener)eventNode).onMouseRightReleased(evt);
}
break;
case 2:
if (eventNode instanceof MouseWheelListener) {
((MouseWheelListener)eventNode).onMouseWheelReleased(evt);
}
break;
}
eventNode = null;
}
}
}