com.badlogic.gdx.controllers.ControllerListener Java Examples

The following examples show how to use com.badlogic.gdx.controllers.ControllerListener. 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: BufferBciController.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called whenever an axis is updated.
 * @param axis
 */
protected void onAxisUpdated(BufferBciAxis axis)
{
    // Inform listeners.
    for (ControllerListener cl : controllerListeners) {
        cl.axisMoved(this, axis.code, axis.value);
    }
}
 
Example #2
Source File: BufferBciController.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called whenever a button is updated.
 * @param btn
 */
private void onButtonUpdated(BufferBciButton btn) {
    // Inform listeners.
    for (ControllerListener cl : controllerListeners) {
        if (btn.activated) {
            cl.buttonDown(this, btn.code);
        } else {
            cl.buttonUp(this, btn.code);
        }
    }
}
 
Example #3
Source File: BufferBciController.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes the BufferBciController instance.
 */
public BufferBciController() {
    this.buttons = new ArrayList<BufferBciButton>();
    this.axes = new ArrayList<BufferBciAxis>();
    this.controllerListeners = new ArrayList<ControllerListener>();
    this.unprocessedEvents = new ArrayList<BufferEvent>();
}
 
Example #4
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean accelerometerMoved(final Controller controller, final int accelerometerCode, final Vector3 value) {
    for (ControllerListener listener : listeners) {
        if (listener.accelerometerMoved(controller, accelerometerCode, value)) {
            return true;
        }
    }
    return false;
}
 
Example #5
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean ySliderMoved(final Controller controller, final int sliderCode, final boolean value) {
    for (ControllerListener listener : listeners) {
        if (listener.ySliderMoved(controller, sliderCode, value)) {
            return true;
        }
    }
    return false;
}
 
Example #6
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean xSliderMoved(final Controller controller, final int sliderCode, final boolean value) {
    for (ControllerListener listener : listeners) {
        if (listener.xSliderMoved(controller, sliderCode, value)) {
            return true;
        }
    }
    return false;
}
 
Example #7
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean povMoved(final Controller controller, final int povCode, final PovDirection value) {
    for (ControllerListener listener : listeners) {
        if (listener.povMoved(controller, povCode, value)) {
            return true;
        }
    }
    return false;
}
 
Example #8
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean buttonDown(final Controller controller, final int buttonCode) {
    for (ControllerListener listener : listeners) {
        if (listener.buttonDown(controller, buttonCode)) {
            return true;
        }
    }
    return false;
}
 
Example #9
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean buttonUp(final Controller controller, final int buttonCode) {
    for (ControllerListener listener : listeners) {
        if (listener.buttonUp(controller, buttonCode)) {
            return true;
        }
    }
    return false;
}
 
Example #10
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 5 votes vote down vote up
@Override
public boolean axisMoved(final Controller controller, final int axisCode, final float value) {
    for (ControllerListener listener : listeners) {
        if (listener.axisMoved(controller, axisCode, value)) {
            return true;
        }
    }
    return false;
}
 
Example #11
Source File: GwtController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void removeListener(ControllerListener listener) {
	this.listeners.removeValue(listener, true);
}
 
Example #12
Source File: JamepadController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void addListener(ControllerListener listener) {
    compositeControllerListener.addListener(listener);
}
 
Example #13
Source File: JamepadController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void removeListener(ControllerListener listener) {
    compositeControllerListener.removeListener(listener);
}
 
Example #14
Source File: GwtController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void addListener(ControllerListener listener) {
	this.listeners.add(listener);
}
 
Example #15
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
public void addListener(ControllerListener listener) {
    listeners.add(listener);
}
 
Example #16
Source File: GwtController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
public Array<ControllerListener> getListeners() {
	return listeners;
}
 
Example #17
Source File: GwtControllers.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void addListener (ControllerListener listener) {
	synchronized (eventQueue) {
		listeners.add(listener);
	}
}
 
Example #18
Source File: GwtControllers.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void removeListener (ControllerListener listener) {
	synchronized (eventQueue) {
		listeners.removeValue(listener, true);
	}
}
 
Example #19
Source File: GwtControllers.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public Array<ControllerListener> getListeners () {
	return listeners;
}
 
Example #20
Source File: BufferBciController.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addListener(ControllerListener listener) {
    controllerListeners.add(listener);
}
 
Example #21
Source File: BufferBciController.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void removeListener(ControllerListener listener) {
    controllerListeners.remove(listener);
}
 
Example #22
Source File: JamepadControllerMonitor.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
public JamepadControllerMonitor(ControllerManager controllerManager, ControllerListener listener) {
    this.controllerManager = controllerManager;
    this.listener = listener;
}
 
Example #23
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
public void removeListener(ControllerListener listener) {
    listeners.remove(listener);
}
 
Example #24
Source File: AndroidControllers.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void addListener (ControllerListener listener) {
	synchronized(eventQueue) {
		listeners.add(listener);
	}
}
 
Example #25
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void disconnected(Controller controller) {
    for (ControllerListener listener : listeners) {
        listener.disconnected(controller);
    }
}
 
Example #26
Source File: CompositeControllerListener.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void connected(Controller controller) {
    for (ControllerListener listener : listeners) {
        listener.connected(controller);
    }
}
 
Example #27
Source File: JamepadControllerManager.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public Array<ControllerListener> getListeners() {
    Array array = new Array();
    array.add(compositeListener);
    return array;
}
 
Example #28
Source File: JamepadControllerManager.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void removeListener(ControllerListener listener) {
    compositeListener.removeListener(listener);
}
 
Example #29
Source File: JamepadControllerManager.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
@Override
public void addListener(ControllerListener listener) {
    compositeListener.addListener(listener);
}
 
Example #30
Source File: AndroidController.java    From gdx-controllerutils with Apache License 2.0 4 votes vote down vote up
public Array<ControllerListener> getListeners() {
	return this.listeners;
}