本文整理汇总了Java中com.jme3.input.controls.JoyButtonTrigger类的典型用法代码示例。如果您正苦于以下问题:Java JoyButtonTrigger类的具体用法?Java JoyButtonTrigger怎么用?Java JoyButtonTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JoyButtonTrigger类属于com.jme3.input.controls包,在下文中一共展示了JoyButtonTrigger类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupFlightJoystickControls
import com.jme3.input.controls.JoyButtonTrigger; //导入依赖的package包/类
public void setupFlightJoystickControls(FlightJoystickControls flightJoystrictControls) {
if (inputManager.getJoysticks() != null && options.getJoyId().isPresent()) {
for (Joystick joy : inputManager.getJoysticks()) {
if (joy.getJoyId() == options.getJoyId().orElse(-1)) {
inputManager.addMapping(JOY_ROLL_RIGHT, new JoyAxisTrigger(joy.getJoyId(), joy.getXAxisIndex(), false));
inputManager.addMapping(JOY_ROLL_LEFT, new JoyAxisTrigger(joy.getJoyId(), joy.getXAxisIndex(), true));
inputManager.addMapping(JOY_PITCH_UP, new JoyAxisTrigger(joy.getJoyId(), joy.getYAxisIndex(), false));
inputManager.addMapping(JOY_PITCH_DOWN, new JoyAxisTrigger(joy.getJoyId(), joy.getYAxisIndex(), true));
inputManager.addMapping(Trigger.FIRE.name(), new JoyButtonTrigger(joy.getJoyId(),0));
break;
}
}
}
inputManager.addListener(flightJoystrictControls, JOY_PITCH_UP, JOY_PITCH_DOWN, JOY_ROLL_LEFT, JOY_ROLL_RIGHT);
}
示例2: onJoyButtonEventQueued
import com.jme3.input.controls.JoyButtonTrigger; //导入依赖的package包/类
private void onJoyButtonEventQueued(JoyButtonEvent evt) {
// for (int i = 0; i < rawListeners.size(); i++){
// rawListeners.get(i).onJoyButtonEvent(evt);
// }
int hash = JoyButtonTrigger.joyButtonHash(evt.getJoyIndex(), evt.getButtonIndex());
invokeActions(hash, evt.isPressed());
invokeTimedActions(hash, evt.getTime(), evt.isPressed());
}
示例3: assignButton
import com.jme3.input.controls.JoyButtonTrigger; //导入依赖的package包/类
/**
* Assign the mapping name to receive events from the given button index
* on the joystick.
*
* @param mappingName The mapping to receive joystick button events.
* @param buttonId The button index.
*
* @see Joystick#getButtonCount()
*/
public void assignButton(String mappingName, int buttonId){
if (buttonId < 0 || buttonId >= buttonCount)
throw new IllegalArgumentException();
inputManager.addMapping(mappingName, new JoyButtonTrigger(joyId, buttonId));
}