com.jme3.input.InputManager Java Examples

The following examples show how to use com.jme3.input.InputManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BattlefieldInputInterpreter.java    From OpenRTS with MIT License 6 votes vote down vote up
@Override
protected void registerInputs(InputManager inputManager) {
	inputManager.addMapping(SWITCH_CTRL_1, new KeyTrigger(KeyInput.KEY_F1));
	inputManager.addMapping(SWITCH_CTRL_2, new KeyTrigger(KeyInput.KEY_F2));
	inputManager.addMapping(SWITCH_CTRL_3, new KeyTrigger(KeyInput.KEY_F3));
	inputManager.addMapping(SELECT, new MouseButtonTrigger(0));
	inputManager.addMapping(ACTION, new MouseButtonTrigger(1));
	inputManager.addMapping(MOVE_ATTACK, new KeyTrigger(KeyInput.KEY_A));
	inputManager.addMapping(MULTIPLE_SELECTION, new KeyTrigger(KeyInput.KEY_LCONTROL),
			new KeyTrigger(KeyInput.KEY_RCONTROL));
	inputManager.addMapping(HOLD, new KeyTrigger(KeyInput.KEY_H));
	inputManager.addMapping(PAUSE, new KeyTrigger(KeyInput.KEY_SPACE));

	inputManager.addListener(this, mappings);

	logger.info("battlefield controller online");
}
 
Example #2
Source File: NiftyJmeDisplay.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public NiftyJmeDisplay(AssetManager assetManager, 
                       InputManager inputManager,
                       AudioRenderer audioRenderer,
                       ViewPort vp){
    this.assetManager = assetManager;

    w = vp.getCamera().getWidth();
    h = vp.getCamera().getHeight();

    soundDev = new SoundDeviceJme(assetManager, audioRenderer);
    renderDev = new RenderDeviceJme(this);
    inputSys = new InputSystemJme(inputManager);
    if (inputManager != null)
        inputManager.addRawInputListener(inputSys);
    
    nifty = new Nifty(renderDev, soundDev, inputSys, new FastTimeProvider());
    inputSys.setNifty(nifty);

    resourceLocation = new ResourceLocationJme();
    nifty.getResourceLoader().removeAllResourceLocations();
    nifty.getResourceLoader().addResourceLocation(resourceLocation);
}
 
Example #3
Source File: AdvancedAbstractEditor3DPart.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@Override
@JmeThread
public void initialize(@NotNull final AppStateManager stateManager, @NotNull final Application application) {
    super.initialize(stateManager, application);
    this.stateManager = stateManager;

    final Node rootNode = EditorUtil.getGlobalRootNode();
    rootNode.attachChild(getStateNode());

    final RenderFilterExtension filterExtension = RenderFilterExtension.getInstance();
    filterExtension.enableFilters();

    final EditorCamera editorCamera = getEditorCamera();
    final InputManager inputManager = EditorUtil.getInputManager();

    checkAndAddMappings(inputManager);
    registerActionListener(inputManager);
    registerAnalogListener(inputManager);

    if (editorCamera != null) {
        editorCamera.setEnabled(true);
        editorCamera.registerInput(inputManager);
    }
}
 
Example #4
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Initializes mouse and keyboard input. Also
 * initializes joystick input if joysticks are enabled in the
 * AppSettings.
 */
private void initInput(){
    mouseInput = context.getMouseInput();
    if (mouseInput != null)
        mouseInput.initialize();

    keyInput = context.getKeyInput();
    if (keyInput != null)
        keyInput.initialize();

    touchInput = context.getTouchInput();
    if (touchInput != null)
        touchInput.initialize();

    if (!settings.getBoolean("DisableJoysticks")){
        joyInput = context.getJoyInput();
        if (joyInput != null)
            joyInput.initialize();
    }

    inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
}
 
Example #5
Source File: Application.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Initializes mouse and keyboard input. Also
 * initializes joystick input if joysticks are enabled in the
 * AppSettings.
 */
private void initInput(){
    mouseInput = context.getMouseInput();
    if (mouseInput != null)
        mouseInput.initialize();

    keyInput = context.getKeyInput();
    if (keyInput != null)
        keyInput.initialize();
    
    touchInput = context.getTouchInput();
    if (touchInput != null)
        touchInput.initialize();

    if (!settings.getBoolean("DisableJoysticks")){
        joyInput = context.getJoyInput();
        if (joyInput != null)
            joyInput.initialize();
    }

    inputManager = new InputManager(mouseInput, keyInput, joyInput, touchInput);
}
 
Example #6
Source File: NiftyJmeDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Create a standard NiftyJmeDisplay. This uses the old Nifty renderer. It's probably slower then the batched
 * renderer and is mainly here for backwards compatibility.
 *
 * @param assetManager jME AssetManager
 * @param inputManager jME InputManager
 * @param audioRenderer jME AudioRenderer
 * @param vp Viewport to use
 */
public NiftyJmeDisplay(AssetManager assetManager,
                       InputManager inputManager,
                       AudioRenderer audioRenderer,
                       ViewPort vp){
    initialize(assetManager, inputManager, audioRenderer, vp);

    this.renderDev = new RenderDeviceJme(this);
    this.batchRendererBackend = null;

    nifty = new Nifty(renderDev, soundDev, inputSys, new AccurateTimeProvider());
    inputSys.setNifty(nifty);

    resourceLocation = new ResourceLocationJme();
    nifty.getResourceLoader().removeAllResourceLocations();
    nifty.getResourceLoader().addResourceLocation(resourceLocation);
}
 
Example #7
Source File: GroundCameraManager.java    From OpenRTS with MIT License 6 votes vote down vote up
@Override
public void registerInputs(InputManager inputManager){
	inputManager.addMapping(ROTATE_UP, new MouseAxisTrigger(MouseInput.AXIS_Y, false));
	inputManager.addMapping(ROTATE_DOWN, new MouseAxisTrigger(MouseInput.AXIS_Y, true));
	inputManager.addMapping(ROTATE_LEFT, new MouseAxisTrigger(MouseInput.AXIS_X, true));
	inputManager.addMapping(ROTATE_RIGHT, new MouseAxisTrigger(MouseInput.AXIS_X, false));

	inputManager.addMapping(STRAFE_LEFT, new KeyTrigger(KeyInput.KEY_Q),
			new KeyTrigger(KeyInput.KEY_LEFT));
	inputManager.addMapping(STRAFE_RIGHT, new KeyTrigger(KeyInput.KEY_D),
			new KeyTrigger(KeyInput.KEY_RIGHT));
	inputManager.addMapping(MOVE_FOREWARD, new KeyTrigger(KeyInput.KEY_Z),
			new KeyTrigger(KeyInput.KEY_UP));
	inputManager.addMapping(MOVE_BACKWARD, new KeyTrigger(KeyInput.KEY_S),
			new KeyTrigger(KeyInput.KEY_DOWN));
	inputManager.addListener(this, mappings);
}
 
Example #8
Source File: NiftyJmeDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private NiftyJmeDisplay(
    final AssetManager assetManager,
    final InputManager inputManager,
    final AudioRenderer audioRenderer,
    final ViewPort viewport,
    final BatchRenderConfiguration batchRenderConfiguration) {
  initialize(assetManager, inputManager, audioRenderer, viewport);

  this.renderDev = null;
  this.batchRendererBackend = new JmeBatchRenderBackend(this);

  nifty = new Nifty(
      new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
      soundDev,
      inputSys,
      new AccurateTimeProvider());
  inputSys.setNifty(nifty);

  resourceLocation = new ResourceLocationJme();
  nifty.getResourceLoader().removeAllResourceLocations();
  nifty.getResourceLoader().addResourceLocation(resourceLocation);
}
 
Example #9
Source File: AdvancedAbstractEditor3DPart.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@Override
@JmeThread
public void cleanup() {
    super.cleanup();

    final RenderFilterExtension filterExtension = RenderFilterExtension.getInstance();
    filterExtension.disableFilters();

    final Node rootNode = EditorUtil.getGlobalRootNode();
    rootNode.detachChild(getStateNode());

    final EditorCamera editorCamera = getEditorCamera();
    final InputManager inputManager = EditorUtil.getInputManager();
    inputManager.removeListener(actionListener);
    inputManager.removeListener(analogListener);

    if (editorCamera != null) {
        editorCamera.setEnabled(false);
        editorCamera.unregisterInput(inputManager);
    }
}
 
Example #10
Source File: ScreenshotAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void initialize(AppStateManager stateManager, Application app) {
    if (!super.isInitialized()){
        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);

        if (shotName == null) {
            shotName = app.getClass().getSimpleName();
        }
    }

    super.initialize(stateManager, app);
}
 
Example #11
Source File: ScreenshotAppState.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void initialize(AppStateManager stateManager, Application app) {
    if (!super.isInitialized()){
        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();
    }
    
    super.initialize(stateManager, app);
}
 
Example #12
Source File: AndroidSensorJoyInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AndroidSensorJoystickAxis(InputManager inputManager, Joystick parent,
                   int axisIndex, String name, String logicalId,
                   boolean isAnalog, boolean isRelative, float deadZone,
                   float maxRawValue) {
    super(inputManager, parent, axisIndex, name, logicalId, isAnalog, isRelative, deadZone);

    this.maxRawValue = maxRawValue;
}
 
Example #13
Source File: NiftyJmeDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new NiftyJmeDisplay for use with the Batched Nifty Renderer (improved Nifty rendering performance).
 *
 * Nifty will use a single texture of the given dimensions (see atlasWidth and atlasHeight parameters). Every
 * graphical asset you're rendering through Nifty will be placed into this big texture. The goal is to render
 * all Nifty components in a single (or at least very few) draw calls. This should speed up rendering quite a
 * bit.
 *
 * Currently you have to make sure to not use more image space than this single texture provides. However, Nifty
 * tries to be smart about this and internally will make sure that only the images are uploaded that your GUI
 * really needs. So in general this shouldn't be an issue.
 *
 * A complete re-organisation of the texture atlas happens when a Nifty screen ends and another begins. Dynamically
 * adding images while a screen is running is supported as well.
 *
 * @param assetManager jME AssetManager
 * @param inputManager jME InputManager
 * @param audioRenderer jME AudioRenderer
 * @param viewport Viewport to use
 * @param atlasWidth the width of the texture atlas Nifty uses to speed up rendering (2048 is a good value)
 * @param atlasHeight the height of the texture atlas Nifty uses to speed up rendering (2048 is a good value)
 *
 * @deprecated use the static factory methods {@link #newNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort) }
 * or {@link #newNiftyJmeDisplay(com.jme3.asset.AssetManager, com.jme3.input.InputManager, com.jme3.audio.AudioRenderer, com.jme3.renderer.ViewPort, de.lessvoid.nifty.render.batch.BatchRenderConfiguration) }
 * instead of this constructor.
 */
public NiftyJmeDisplay(
    final AssetManager assetManager,
    final InputManager inputManager,
    final AudioRenderer audioRenderer,
    final ViewPort viewport,
    final int atlasWidth,
    final int atlasHeight) {
  // The code duplication in here really sucks - it's a copy of the
  // private constructor below that takes a BatchRenderConfiguration as an
  // additional parameter. This method should really be removed soon and
  // users should simply call the new factory methods.
  //
  // For now I keep this constructor as-is but have marked it as deprecated
  // to allow migration to the new way to instantiate this class.
  initialize(assetManager, inputManager, audioRenderer, viewport);

  this.renderDev = null;
  this.batchRendererBackend = new JmeBatchRenderBackend(this);

  BatchRenderConfiguration batchRenderConfiguration = new BatchRenderConfiguration();
  batchRenderConfiguration.atlasWidth = atlasWidth;
  batchRenderConfiguration.atlasHeight = atlasHeight;

  nifty = new Nifty(
      new BatchRenderDevice(batchRendererBackend, batchRenderConfiguration),
      soundDev,
      inputSys,
      new AccurateTimeProvider());
  inputSys.setNifty(nifty);

  resourceLocation = new ResourceLocationJme();
  nifty.getResourceLoader().removeAllResourceLocations();
  nifty.getResourceLoader().addResourceLocation(resourceLocation);
}
 
Example #14
Source File: AndroidSensorJoyInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AndroidSensorJoystick( InputManager inputManager, JoyInput joyInput,
                        int joyId, String name){

    super( inputManager, joyInput, joyId, name );

    this.nullAxis = new DefaultJoystickAxis( getInputManager(), this, -1,
                                             "Null", "null", false, false, 0 );
    this.xAxis = nullAxis;
    this.yAxis = nullAxis;
    this.povX = nullAxis;
    this.povY = nullAxis;

}
 
Example #15
Source File: GroundInputInterpreter.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
protected void unregisterInputs(InputManager inputManager) {
	for (String s : mappings) {
		if (inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
Example #16
Source File: AndroidJoystickJoyInput14.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AndroidJoystick( InputManager inputManager, JoyInput joyInput, InputDevice device,
                       int joyId, String name ) {
    super( inputManager, joyInput, joyId, name );

    this.device = device;

    this.nullAxis = new DefaultJoystickAxis( getInputManager(), this, -1,
                                             "Null", "null", false, false, 0 );
    this.xAxis = nullAxis;
    this.yAxis = nullAxis;
    this.povX = nullAxis;
    this.povY = nullAxis;
}
 
Example #17
Source File: GroundController.java    From OpenRTS with MIT License 5 votes vote down vote up
public GroundController(EditorView view, Nifty nifty, InputManager inputManager, Camera cam) {
	super(view, inputManager, cam);

	inputInterpreter = new GroundInputInterpreter(this);
	cameraManager = new GroundCameraManager(cam);
	guiController = new GroundGUIController(nifty, this);
}
 
Example #18
Source File: AndroidJoyInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Joystick[] loadJoysticks(InputManager inputManager) {
    logger.log(Level.INFO, "loading joysticks for {0}", this.getClass().getName());
    if (!disableSensors) {
        joystickList.add(sensorJoyInput.loadJoystick(joystickList.size(), inputManager));
    }
    return joystickList.toArray( new Joystick[joystickList.size()] );
}
 
Example #19
Source File: AndroidJoyInput14.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Joystick[] loadJoysticks(InputManager inputManager) {
    // load the simulated joystick for device orientation
    super.loadJoysticks(inputManager);
    // load physical gamepads/joysticks
    joystickList.addAll(joystickJoyInput.loadJoysticks(joystickList.size(), inputManager));
    // return the list of joysticks back to InputManager
    return joystickList.toArray( new Joystick[joystickList.size()] );
}
 
Example #20
Source File: JInputJoyInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Joystick[] loadJoysticks(InputManager inputManager){
    ControllerEnvironment ce =
        ControllerEnvironment.getDefaultEnvironment();

    Controller[] cs = ce.getControllers();
    
    List<Joystick> list = new ArrayList<Joystick>();
    for( Controller c : ce.getControllers() ) {
        if (c.getType() == Controller.Type.KEYBOARD
         || c.getType() == Controller.Type.MOUSE)
            continue;

        logger.log(Level.FINE, "Attempting to create joystick for: \"{0}\"", c);        
 
        // Try to create it like a joystick
        JInputJoystick stick = new JInputJoystick(inputManager, this, c, list.size(), c.getName()); 
        for( Component comp : c.getComponents() ) {
            stick.addComponent(comp);                   
        }
 
        // If it has no axes then we'll assume it's not
        // a joystick
        if( stick.getAxisCount() == 0 ) {
            logger.log(Level.FINE, "Not a joystick: {0}", c);
            continue;
        }
 
        joystickIndex.put(c, stick);
        list.add(stick);                      
    }

    joysticks = list.toArray( new JInputJoystick[list.size()] );
    
    return joysticks;
}
 
Example #21
Source File: ShadowTestUIManager.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ShadowTestUIManager(AssetManager assetManager,AbstractShadowRenderer plsr, AbstractShadowFilter plsf, 
        Node guiNode, InputManager inputManager, ViewPort viewPort) {
    this.plsr = plsr;
    this.plsf = plsf;
    this.viewPort = viewPort;
    BitmapFont guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    shadowTypeText = createText(guiFont);
    shadowCompareText = createText(guiFont);
    shadowFilterText = createText(guiFont);
    shadowIntensityText = createText(guiFont);

    shadowTypeText.setText(TYPE_TEXT + "Processor");
    shadowCompareText.setText(COMPARE_TEXT + (hardwareShadows ? "Hardware" : "Software"));
    shadowFilterText.setText(FILTERING_TEXT + plsr.getEdgeFilteringMode().toString());
    shadowIntensityText.setText(INTENSITY_TEXT + plsr.getShadowIntensity());

    shadowTypeText.setLocalTranslation(10, viewPort.getCamera().getHeight() - 20, 0);
    shadowCompareText.setLocalTranslation(10, viewPort.getCamera().getHeight() - 40, 0);
    shadowFilterText.setLocalTranslation(10, viewPort.getCamera().getHeight() - 60, 0);
    shadowIntensityText.setLocalTranslation(10, viewPort.getCamera().getHeight() - 80, 0);

    guiNode.attachChild(shadowTypeText);
    guiNode.attachChild(shadowCompareText);
    guiNode.attachChild(shadowFilterText);
    guiNode.attachChild(shadowIntensityText);

    inputManager.addMapping("toggle", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addMapping("changeFiltering", new KeyTrigger(KeyInput.KEY_F));
    inputManager.addMapping("ShadowUp", new KeyTrigger(KeyInput.KEY_T));
    inputManager.addMapping("ShadowDown", new KeyTrigger(KeyInput.KEY_G));
    inputManager.addMapping("ThicknessUp", new KeyTrigger(KeyInput.KEY_Y));
    inputManager.addMapping("ThicknessDown", new KeyTrigger(KeyInput.KEY_H));
    inputManager.addMapping("toggleHW", new KeyTrigger(KeyInput.KEY_RETURN));


    inputManager.addListener(this, "toggleHW", "toggle", "ShadowUp", "ShadowDown", "ThicknessUp", "ThicknessDown", "changeFiltering");

}
 
Example #22
Source File: GroundInputInterpreter.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
protected void registerInputs(InputManager inputManager) {
	inputManager.addMapping(SWITCH_CTRL_1, new KeyTrigger(KeyInput.KEY_F1));
	inputManager.addMapping(SWITCH_CTRL_2, new KeyTrigger(KeyInput.KEY_F2));
	inputManager.addMapping(SWITCH_CTRL_3, new KeyTrigger(KeyInput.KEY_F3));
	inputManager.addListener(this, mappings);
	logger.info("Ground conroller online");
}
 
Example #23
Source File: BasicProfilerState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void cleanup( Application app ) {    
    InputManager inputManager = app.getInputManager();        
    if( inputManager.hasMapping(INPUT_MAPPING_PROFILER_TOGGLE) ) {
        inputManager.deleteMapping(INPUT_MAPPING_PROFILER_TOGGLE);        
    }
    inputManager.removeListener(keyListener);
}
 
Example #24
Source File: IsometricCameraManager.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
public void unregisterInputs(InputManager inputManager){
	for(String s : mappings) {
		if(inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
Example #25
Source File: IsometricCameraManager.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
public void registerInputs(InputManager inputManager){
	inputManager.addMapping(STRAFE_NORTH, new KeyTrigger(KeyInput.KEY_UP));
	inputManager.addMapping(STRAFE_SOUTH, new KeyTrigger(KeyInput.KEY_DOWN));
	inputManager.addMapping(STRAFE_EAST, new KeyTrigger(KeyInput.KEY_RIGHT));
	inputManager.addMapping(STRAFE_WEST, new KeyTrigger(KeyInput.KEY_LEFT));
	inputManager.addMapping(ZOOM_IN, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
	inputManager.addMapping(ZOOM_OUT, new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
	inputManager.addListener(this, mappings);
}
 
Example #26
Source File: GroundCameraManager.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
public void unregisterInputs(InputManager inputManager){
	for(String s : mappings) {
		if(inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
Example #27
Source File: EditorInputInterpreter.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
protected void unregisterInputs(InputManager inputManager) {
	for (String s : mappings) {
		if (inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}
 
Example #28
Source File: EditorController.java    From OpenRTS with MIT License 5 votes vote down vote up
public EditorController(EditorView view, Nifty nifty, InputManager inputManager, Camera cam) {
	super(view, inputManager, cam);
	this.view = view;
	inputInterpreter = new EditorInputInterpreter(this);
	guiController = new EditorGUIController(nifty, this);
	cameraManager = new IsometricCameraManager(cam, 10);

	EventManager.register(this);
}
 
Example #29
Source File: BattlefieldController.java    From OpenRTS with MIT License 5 votes vote down vote up
public BattlefieldController(MapView view, Nifty nifty, InputManager inputManager, Camera cam) {
	super(view, inputManager, cam);
	this.view = view;
	inputInterpreter = new BattlefieldInputInterpreter(this);
	guiController = new BattlefieldGUIController(nifty, this);

	EventManager.register(this);

	cameraManager = new IsometricCameraManager(cam, 10);
}
 
Example #30
Source File: BattlefieldInputInterpreter.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
protected void unregisterInputs(InputManager inputManager) {
	for (String s : mappings) {
		if (inputManager.hasMapping(s)) {
			inputManager.deleteMapping(s);
		}
	}
	inputManager.removeListener(this);
}