Java Code Examples for org.lwjgl.input.Mouse#next()

The following examples show how to use org.lwjgl.input.Mouse#next() . 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: GuiScreenEditKeys.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleInput() throws IOException {
    if (listeningForNewKey) {
        if (Mouse.next()) {
            int button = Mouse.getEventButton();
            if (Mouse.isButtonDown(button)) {
                selected.getKey().setKey(button - 100);
                listeningForNewKey = false;
                changeKey.displayString = "Change key";
                return;
            }
        }

        if (Keyboard.next()) {
            int key = Keyboard.getEventKey();
            if (Keyboard.isKeyDown(key)) {
                selected.getKey().setKey(key);
                listeningForNewKey = false;
                changeKey.displayString = "Change key";
                return;
            }
        }
    }

    super.handleInput();
}
 
Example 2
Source File: Game.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the input.
 *
 * @return the input
 */
public static void getInput() {
	Keyboard.poll();
	keys.clear();
	while(Keyboard.next()) {
		KeyboardEvent ke = new KeyboardEvent(Keyboard.getEventKey(), Keyboard.getEventCharacter(),
        Keyboard.isRepeatEvent(), Keyboard.getEventKeyState(), KeyboardEvent.generateModifiers());
		keys.add(ke);
	}
	Mouse.poll();
	mouseEvents.clear();
	while(Mouse.next()) {
		MouseEvent me = new MouseEvent(
				Mouse.getEventX(),
				Mouse.getEventY(),
				Mouse.getEventDWheel(),
				Mouse.getEventButton(),
				Mouse.getEventButtonState());
		mouseEvents.add(me);
	}
}
 
Example 3
Source File: Game.java    From FEMultiplayer with GNU General Public License v3.0 6 votes vote down vote up
public static void getInput() {
	Keyboard.poll();
	keys.clear();
	while(Keyboard.next()) {
		KeyboardEvent ke = new KeyboardEvent(
				Keyboard.getEventKey(),
				Keyboard.getEventCharacter(),
				Keyboard.isRepeatEvent(),
				Keyboard.getEventKeyState());
		keys.add(ke);
	}
	Mouse.poll();
	mouseEvents.clear();
	while(Mouse.next()) {
		MouseEvent me = new MouseEvent(
				Mouse.getEventX(),
				Mouse.getEventY(),
				Mouse.getEventDWheel(),
				Mouse.getEventButton(),
				Mouse.getEventButtonState());
		mouseEvents.add(me);
	}
}
 
Example 4
Source File: GuiScreenPlus.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleInput()
{
    while(Mouse.next())
    {
        this.handleMouseInput();
    }

    while(Keyboard.next())
    {
        this.handleKeyboardInput();
    }
}
 
Example 5
Source File: PointerInput.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
private static void resetCursorPos() {
	setCursorPosition(LocalInput.getMouseX(), LocalInput.getMouseY());
	// clear event queue
	while (Mouse.isCreated() && Mouse.next());
}