Java Code Examples for com.badlogic.gdx.Input.Keys#CONTROL_LEFT

The following examples show how to use com.badlogic.gdx.Input.Keys#CONTROL_LEFT . 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: Terminal.java    From seventh with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean keyUp(int key) {
    if(!isActive) {
        return false;
    }
    
    switch(key) {
        case Keys.PAGE_UP: {
            scrollY = 0;                    
            break;
        }
        case Keys.PAGE_DOWN: {
            scrollY = 0;
            break;
        }
        case Keys.CONTROL_LEFT:
        case Keys.CONTROL_RIGHT:
            isCtrlDown = false;
            break;
        default: {                    
        }
    }
    return true;
}
 
Example 2
Source File: OsUtils.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/**
 * Creates platform dependant shortcut text. Converts int keycodes to String text. Eg. Keys.CONTROL_LEFT,
 * Keys.SHIFT_LEFT, Keys.F5 will be converted to Ctrl+Shift+F5 on Windows and Linux, and to ⌘⇧F5 on Mac.
 * <p>
 * CONTROL_LEFT and CONTROL_RIGHT and SYM are mapped to Ctrl. The same goes for Alt (ALT_LEFT, ALT_RIGHT) and Shift (SHIFT_LEFT, SHIFT_RIGHT).
 * <p>
 * Keycodes equal to {@link Integer#MIN_VALUE} will be ignored.
 * @param keycodes keycodes from {@link Keys} that are used to create shortcut text
 * @return the platform dependent shortcut text
 */
public static String getShortcutFor (int... keycodes) {
	StringBuilder builder = new StringBuilder();

	String separatorString = "+";
	String ctrlKey = "Ctrl";
	String altKey = "Alt";
	String shiftKey = "Shift";

	if (OsUtils.isMac()) {
		separatorString = "";
		ctrlKey = "\u2318";
		altKey = "\u2325";
		shiftKey = "\u21E7";
	}

	for (int i = 0; i < keycodes.length; i++) {
		if (keycodes[i] == Integer.MIN_VALUE) {
			continue;
		}

		if (keycodes[i] == Keys.CONTROL_LEFT || keycodes[i] == Keys.CONTROL_RIGHT || keycodes[i] == Keys.SYM) {
			builder.append(ctrlKey);
		} else if (keycodes[i] == Keys.SHIFT_LEFT || keycodes[i] == Keys.SHIFT_RIGHT) {
			builder.append(shiftKey);
		} else if (keycodes[i] == Keys.ALT_LEFT || keycodes[i] == Keys.ALT_RIGHT) {
			builder.append(altKey);
		} else {
			builder.append(Keys.toString(keycodes[i]));
		}

		if (i < keycodes.length - 1) { // Is this NOT the last key
			builder.append(separatorString);
		}
	}

	return builder.toString();
}
 
Example 3
Source File: PlayModeConfig.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public void validate(int keys) {
    if(playconfig == null) {
        playconfig = new PlayConfig();
    }

    playconfig.validate();

    if (keyboard.keys == null) {
        keyboard.keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
                Keys.CONTROL_LEFT };
    }
    if (keyboard.keys.length != keys) {
        keyboard.keys = Arrays.copyOf(keyboard.keys, keys);
    }
    keyboard.duration = MathUtils.clamp(keyboard.duration, 0, 100);

    int index = 0;
    for (ControllerConfig c : controller) {
        if (c.keys == null) {
            c.keys = new int[] { BMKeys.BUTTON_4, BMKeys.BUTTON_7, BMKeys.BUTTON_3, BMKeys.BUTTON_8,
                    BMKeys.BUTTON_2, BMKeys.BUTTON_5, BMKeys.LEFT, BMKeys.UP, BMKeys.DOWN };
        }
        if (c.keys.length != keys) {
            int[] newkeys = new int[keys];
            Arrays.fill(newkeys, -1);
            for (int i = 0; i < c.keys.length && index < newkeys.length; i++, index++) {
                newkeys[index] = c.keys[i];
            }
            c.keys = newkeys;
        }
        c.duration = MathUtils.clamp(c.duration, 0, 100);
    }

    if (midi.keys == null) {
        midi.keys = new MidiConfig().keys;
    }
    if (midi.keys.length != keys) {
        midi.keys = Arrays.copyOf(midi.keys, keys);
    }

    // KB, コントローラー, Midiの各ボタンについて排他的処理を実施
    boolean[] exclusive = new boolean[keyboard.keys.length];
    validate0(keyboard.keys,  exclusive);
    for(int i = 0;i < controller.length;i++) {
        validate0(controller[i].keys,  exclusive);
    }

    for(int i = 0;i < midi.getKeys().length;i++) {
        if(exclusive[i]) {
            midi.getKeys()[i] = null;
        }
    }
}
 
Example 4
Source File: PlayModeConfig.java    From beatoraja with GNU General Public License v3.0 4 votes vote down vote up
public void setKeyAssign(Mode mode, boolean enable) {
    switch (mode) {
        case BEAT_5K:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT };
            break;
        case BEAT_7K:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT };
            break;
        case BEAT_10K:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
            break;
        case BEAT_14K:
        default:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
                    Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
            break;
        case POPN_5K:
        case POPN_9K:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.G, Keys.B };
            break;
        case KEYBOARD_24K:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
                    Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
            keys = Arrays.copyOf(keys, 26);
            break;
        case KEYBOARD_24K_DOUBLE:
            keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
                    Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
                    Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
            keys = Arrays.copyOf(keys, 52);
            break;
    }
    if(!enable) {
        Arrays.fill(keys, -1);
    }
    start = Keys.Q;
    select = Keys.W;
}