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


Java JoyButtonTrigger類代碼示例

本文整理匯總了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);
}
 
開發者ID:ZoltanTheHun,項目名稱:SkyHussars,代碼行數:16,代碼來源:ControlsMapper.java

示例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());
    }
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:10,代碼來源:InputManager.java

示例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));
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:16,代碼來源:Joystick.java


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