Java Code Examples for org.lwjgl.input.Keyboard#KEY_NONE

The following examples show how to use org.lwjgl.input.Keyboard#KEY_NONE . 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: BindsCmd.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
private void remove(String[] args) throws CmdException
{
	if(args.length != 2)
		throw new CmdSyntaxError();
	
	String key = args[1].toUpperCase();
	if(Keyboard.getKeyIndex(key) == Keyboard.KEY_NONE)
		throw new CmdSyntaxError("Unknown key: " + key);
	
	String oldCommands = wurst.getKeybinds().getCommands(key);
	if(oldCommands == null)
		throw new CmdError("Nothing to remove.");
	
	wurst.getKeybinds().remove(key);
	ChatUtils.message("Keybind removed: " + key + " -> " + oldCommands);
}
 
Example 2
Source File: KeybindsModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void keyPress(EventKeyPress event) {
    for(Module mod : Seppuku.INSTANCE.getModuleManager().getModuleList()) {
        if(mod != null) {
            if(mod.getType() != ModuleType.HIDDEN && event.getKey() == Keyboard.getKeyIndex(mod.getKey()) && Keyboard.getKeyIndex(mod.getKey()) != Keyboard.KEY_NONE) {
                mod.toggle();
            }
        }
    }
}
 
Example 3
Source File: KeyboardInput.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final boolean doPoll(GUIRoot gui_root) {
	Deterministic deterministic = LocalEventQueue.getQueue().getDeterministic();
	LocalInput local_input = LocalInput.getLocalInput();
	boolean result = false;
	Keyboard.poll();
	while (deterministic.log(Keyboard.next())) {
		result = true;
		int event_key = deterministic.log(Keyboard.getEventKey());
		boolean event_key_state = deterministic.log(Keyboard.getEventKeyState());
		char event_character = deterministic.log(Keyboard.getEventCharacter());
		boolean repeat_event = deterministic.log(Keyboard.isRepeatEvent());
		switch (event_key) {
			case Keyboard.KEY_LSHIFT:
			case Keyboard.KEY_RSHIFT:
				shift_down = event_key_state;
				break;
			case Keyboard.KEY_LCONTROL:
			case Keyboard.KEY_RCONTROL:
				control_down = event_key_state;
				break;
			case Keyboard.KEY_LMENU:
			case Keyboard.KEY_RMENU:
				menu_down = event_key_state;
				break;
		}
		if (checkMagicKey(deterministic, event_key_state, event_key, false, repeat_event))
			continue;
		if (event_key == Keyboard.KEY_NONE) {
			local_input.keyTyped(gui_root, event_key, event_character);
		} else if (event_key_state) {
			local_input.keyPressed(gui_root, event_key, event_character, shift_down, control_down, menu_down, repeat_event);
		} else {
			local_input.keyReleased(gui_root, event_key, event_character, shift_down, control_down, menu_down);
		}
	}
	return result;
}
 
Example 4
Source File: KeyOption.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void read(String s)
{
	this.keycode = Keyboard.getKeyIndex(s);
	if (this.keycode == Keyboard.KEY_NONE) {
		this.keycode = Keyboard.KEY_X;
	}
}
 
Example 5
Source File: BindsCmd.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void add(String[] args) throws CmdException
{
	if(args.length < 3)
		throw new CmdSyntaxError();
	
	String key = args[1].toUpperCase();
	if(Keyboard.getKeyIndex(key) == Keyboard.KEY_NONE)
		throw new CmdSyntaxError("Unknown key: " + key);
	
	String commands =
		String.join(" ", Arrays.copyOfRange(args, 2, args.length));
	
	wurst.getKeybinds().add(key, commands);
	ChatUtils.message("Keybind set: " + key + " -> " + commands);
}
 
Example 6
Source File: MacroModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void keyPress(EventKeyPress event) {
    for(Macro macro : Seppuku.INSTANCE.getMacroManager().getMacroList()) {
        if(event.getKey() == Keyboard.getKeyIndex(macro.getKey()) && Keyboard.getKeyIndex(macro.getKey()) != Keyboard.KEY_NONE) {
            final String[] split = macro.getMacro().split(";");

            for(String s : split) {
                Minecraft.getMinecraft().player.sendChatMessage(s);
            }
        }
    }
}
 
Example 7
Source File: FlipKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FlipKeybind() {
    super("Flip (Requires Purchase)", Keyboard.KEY_NONE);
}
 
Example 8
Source File: HideLeatherKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public HideLeatherKeybind() {
    super("Toggle Leather Armor", Keyboard.KEY_NONE);
}
 
Example 9
Source File: TwerkDanceKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TwerkDanceKeybind() {
    super("Twerk", Keyboard.KEY_NONE);
}
 
Example 10
Source File: DabKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public DabKeybind() {
    super("Dab", Keyboard.KEY_NONE);
}
 
Example 11
Source File: TPoseKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TPoseKeybind() {
    super("T-Pose", Keyboard.KEY_NONE);
}
 
Example 12
Source File: FlossKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FlossKeybind() {
    super("Floss dance", Keyboard.KEY_NONE);
}
 
Example 13
Source File: Module.java    From ClientBase with MIT License 4 votes vote down vote up
protected Module(String name, String description, ModuleCategory moduleCategory) {
    this(name, description, moduleCategory, true, false, Keyboard.KEY_NONE);
}
 
Example 14
Source File: Options.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the left game key.
 * @return the left key code
 */
public static int getGameKeyLeft() {
	if (keyLeft == Keyboard.KEY_NONE)
		setGameKeyLeft(Input.KEY_Z);
	return keyLeft;
}
 
Example 15
Source File: Options.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the right game key.
 * @return the right key code
 */
public static int getGameKeyRight() {
	if (keyRight == Keyboard.KEY_NONE)
		setGameKeyRight(Input.KEY_X);
	return keyRight;
}
 
Example 16
Source File: LangUtils.java    From WearableBackpacks with MIT License 4 votes vote down vote up
/** Formats a tooltip translation key containing a single
 *  key binding argument and adds it to the tooltip list.
 *  Doesn't do anything if key is unbound. */
@SideOnly(Side.CLIENT)
public static void formatTooltipKey(List<String> tooltip, String langKey, KeyBinding keyBinding) {
	if (keyBinding.getKeyCode() == Keyboard.KEY_NONE) return;
	formatTooltip(tooltip, langKey, "\u00A76" + keyBinding.getDisplayName() + "\u00A77");
}
 
Example 17
Source File: Options.java    From opsu with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets the left game key.
 * This will not be set to the same key as the right game key, nor to any
 * reserved keys (see {@link #isValidGameKey(int)}).
 * @param key the keyboard key
 * @return {@code true} if the key was set, {@code false} if it was rejected
 */
public static boolean setGameKeyLeft(int key) {
	if ((key == keyRight && key != Keyboard.KEY_NONE) || !isValidGameKey(key))
		return false;
	keyLeft = key;
	return true;
}
 
Example 18
Source File: Options.java    From opsu with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets the right game key.
 * This will not be set to the same key as the left game key, nor to any
 * reserved keys (see {@link #isValidGameKey(int)}).
 * @param key the keyboard key
 * @return {@code true} if the key was set, {@code false} if it was rejected
 */
public static boolean setGameKeyRight(int key) {
	if ((key == keyLeft && key != Keyboard.KEY_NONE) || !isValidGameKey(key))
		return false;
	keyRight = key;
	return true;
}