本文整理匯總了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;
}
示例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();
}
示例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));
}
}