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


Java Application.getInputManager方法代碼示例

本文整理匯總了Java中com.jme3.app.Application.getInputManager方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getInputManager方法的具體用法?Java Application.getInputManager怎麽用?Java Application.getInputManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.app.Application的用法示例。


在下文中一共展示了Application.getInputManager方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
public void initialize(AppStateManager stateManager, Application app) {
    if (niftyXmlPath != null) {
        NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(),
                app.getInputManager(),
                app.getAudioRenderer(),
                app.getGuiViewPort());
        nifty = niftyDisplay.getNifty();
        nifty.fromXmlWithoutStartScreen(niftyXmlPath);
        app.getGuiViewPort().addProcessor(niftyDisplay);
    }
    for (CinematicEvent cinematicEvent : cinematicEvents) {
        cinematicEvent.initEvent(app, this);
    }



    initialized = true;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:19,代碼來源:Cinematic.java

示例2: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);

    InputManager inputManager = app.getInputManager();
    inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ));
    inputManager.addListener(this, "ScreenShot");

    List<ViewPort> vps = app.getRenderManager().getPostViews();
    ViewPort last = vps.get(vps.size()-1);
    last.addProcessor(this);

    appName = app.getClass().getSimpleName();
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:15,代碼來源:ScreenshotAppState.java

示例3: initialize

import com.jme3.app.Application; //導入方法依賴的package包/類
/**
 * Initialise play state.
 * @param stateManager The application state manager.
 * @param app The game application object.
 */
@Override
public void initialize(AppStateManager stateManager, Application app) {
  super.initialize(stateManager, app);
  this.app = (SimpleApplication) app;
  this.rootNode = this.app.getRootNode();

  // Initialise physics.
  bullet = new BulletAppState();
  stateManager.attach(bullet);

  // Create ambient light for world.
  AmbientLight ambientLight = new AmbientLight();
  ambientLight.setColor(ColorRGBA.White.mult(1.3f));
  this.rootNode.addLight(ambientLight);

  // Load current course.
  Spatial course
      = app.getAssetManager().loadModel("Scenes/DeveloperCourse/Course.j3o");
  this.rootNode.attachChild(course);

  // Fetch and initialise the course path.
  coursePath = new CoursePath((Node) course, bullet);

  // Create player manager either for server or client.
  if (isServer) {
    playerManager = new PlayerManager(this.app, coursePath, bullet,
                                      totalPlayers);
  } else {
    playerManager = new PlayerManager(this.app, coursePath, bullet,
                                      totalPlayers, localPlayerIdx);

    // Create the camera attached to the player.
    followCamera = new FollowCamera(this.app.getCamera(),
        playerManager.getLocalPlayer(), CAMERA_DISTANCE);

    // Capture input to player.
    InputManager input = app.getInputManager();
    String[] mappingNames = new String[] { PlayerInput.MOVE_LEFT,
        PlayerInput.MOVE_RIGHT, PlayerInput.MOVE_UP, PlayerInput.MOVE_DOWN };
    playerInput = new PlayerInput(playerManager.getLocalPlayer());
    input.addListener(playerInput, mappingNames);
    input.addMapping(PlayerInput.MOVE_LEFT, new KeyTrigger(KeyInput.KEY_A));
    input.addMapping(PlayerInput.MOVE_RIGHT, new KeyTrigger(KeyInput.KEY_D));
    input.addMapping(PlayerInput.MOVE_UP, new KeyTrigger(KeyInput.KEY_S));
    input.addMapping(PlayerInput.MOVE_DOWN, new KeyTrigger(KeyInput.KEY_W));
  }
}
 
開發者ID:meoblast001,項目名稱:seally-racing,代碼行數:53,代碼來源:PlayState.java


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