當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEY_NONE屬性代碼示例

本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_NONE屬性的具體用法?Java Keyboard.KEY_NONE怎麽用?Java Keyboard.KEY_NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_NONE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: func_146282_l

@Override
public void func_146282_l() {
    if (Bit.getInstance() == null) {
        return;
    }
    int key = Keyboard.getEventKey();
    char cha = Keyboard.getEventCharacter();
    if (key == Keyboard.KEY_NONE) return;

    if (key == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) {
        Wrapper.displayGuiScreen(null);
        return;
    }

    if (key == Keyboard.KEY_F11) Wrapper.getMinecraft().func_71352_k();

    Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
    while (iter.hasNext()) {
        Window comp = iter.next();
        if (Keyboard.getEventKeyState())
            comp.keyPress(key, cha);
        else
            comp.keyRelease(key, cha);
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:25,代碼來源:ClickGuiDisplayer.java

示例2: keyPress

@Override
public void keyPress(int key, char keyChar) {
    if (this.extended)
        this.componentList.keyPress(key, keyChar);

    if (this.binding) {
        if (key != Keyboard.KEY_NONE && key != Keyboard.KEY_ESCAPE && key != Keyboard.KEY_LSHIFT && key != Keyboard.KEY_GRAVE && key != Keyboard.KEY_RSHIFT) {
            this.mod.setKeybind(key);
            new Thread(() -> {
                if (this.title == null || mod == null) return;
                this.title = "Bound to " + Keyboard.getKeyName(key);
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
                if (this.title == null || mod == null) return;
                this.title = mod.getId();
            }).start();
            this.binding = false;
        }
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:22,代碼來源:ModComponent.java

示例3: remove

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);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:16,代碼來源:BindsCmd.java

示例4: keyTyped

@Override
protected void keyTyped(char c, int key) throws IOException {
    if (Widget.getFocused() == null) {
        if (key == Keyboard.KEY_ESCAPE || !justOpened && key == menuKey && key != Keyboard.KEY_NONE) {
            super.keyTyped(c, Keyboard.KEY_ESCAPE);
        } else if (key == Keyboard.KEY_DELETE) {
            Widget widget = Widget.getHovered();
            if (isElement(widget)) {
                widget.setActivated(true);
                widget.setValue(null);
            }
        }
    } else {
        Widget.getFocused().keyTyped(c, key);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:16,代碼來源:ConfigMenu.java

示例5: getKeyId

public static int getKeyId(String name) {
    if (name.equals("") || name.equals("NONE")) return Keyboard.KEY_NONE;
    name = name.toUpperCase();
    String param = null;
    if (name.startsWith("MOUSE")) {
        param = name.substring(5);
    }
    if (name.startsWith("BUTTON")) {
        param = name.substring(6);
    }
    if (param != null) {
        try {
            int button = Integer.parseInt(param);
            if (button >= 0 && button < 256) return button | MOUSE;
        } catch (Exception e) {
        }
        return -1;
    }
    int key = Keyboard.getKeyIndex(name.toUpperCase());
    return key;
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:21,代碼來源:KeyHelper.java

示例6: invoke

@Override
public void invoke(Event e) {
    InputEvent.KeyInputEvent event = (InputEvent.KeyInputEvent) e;
    if (!Keyboard.getEventKeyState()) return;
    if (Keyboard.getEventKey() == Keyboard.KEY_NONE) return;
    new KeypressEvent(Keyboard.getEventKey()).call();
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:7,代碼來源:KeypressEventDispatcher.java

示例7: add

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);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:15,代碼來源:BindsCmd.java

示例8: getKeyName

public static String getKeyName(int key) {
    if (key == Keyboard.KEY_NONE) 
        return "NONE";
    if ((key & MOUSE) != 0)
        return "MOUSE"+(key ^ MOUSE);
    String res = Keyboard.getKeyName(key);
    return res != null ? res : ""+key;
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:8,代碼來源:KeyHelper.java

示例9: keyTyped

@Override
public void keyTyped(char c, int key) {
    if (!hasFocus()) return;
    if (key == Keyboard.KEY_ESCAPE) {
        setFocused(false);
    } else if (key != Keyboard.KEY_NONE) {
        setValue(new KeyBind(key));
        setFocused(false);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:10,代碼來源:KeyBinder.java

示例10: getKeyDown

private int getKeyDown() {
    for (int i = 1; i < keysDown.length; ++i)
        if (keysDown[i]) return i;
    for (int i = 0; i < mouseDown.length && i < Mouse.getButtonCount(); ++i)
        if (mouseDown[i]) return i | KeyHelper.MOUSE;
    return Keyboard.KEY_NONE;
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:7,代碼來源:Keys.java

示例11: getKeyPressed

private int getKeyPressed() {
    for (int i = 1; i < keysDown.length; ++i)
        if (keysDown[i] && !keysPrev[i]) return i;
    for (int i = 0; i < mouseDown.length && i < Mouse.getButtonCount(); ++i)
        if (mouseDown[i] && !mousePrev[i]) return i | KeyHelper.MOUSE;
    return Keyboard.KEY_NONE;
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:7,代碼來源:Keys.java

示例12: runTickKeyboard

@Inject(method = "runTick", at = @At(
        value = "INVOKE",
        remap = false,
        target = "Lorg/lwjgl/input/Keyboard;getEventKey()I",
        ordinal = 0,
        shift = At.Shift.BEFORE))
public void runTickKeyboard(CallbackInfo callback) throws IOException {
    int key = Keyboard.getEventKey();
    boolean state = Keyboard.getEventKeyState();

    if (key != Keyboard.KEY_NONE)
        EventManager.post(new KeyEvent(key, state));
}
 
開發者ID:SerenityEnterprises,項目名稱:SerenityCE,代碼行數:13,代碼來源:MixinMinecraft.java

示例13: Module

public Module(String name, String description) {
    this(name, description, Keyboard.KEY_NONE);
}
 
開發者ID:ImpactDevelopment,項目名稱:ClientAPI,代碼行數:3,代碼來源:Module.java

示例14: handleKeyboardInput

@Override
public void handleKeyboardInput() throws IOException {
    int keyCode = Keyboard.getEventKey();
    if(keyCode == Keyboard.KEY_NONE || keyCode >= Keyboard.KEYBOARD_SIZE) return; // unknown key or key index greater than what lwjgl supports

    if(keyCode == Keyboard.KEY_ESCAPE) {
        MC.displayGuiScreen(null);
        return;
    }

    InputEntry entry = inputs.computeIfAbsent(keyCode, i -> new InputEntry(InputEntry.KEYBOARD, keyCode));

    boolean down = Keyboard.getEventKeyState();
    long currentTimeMS = System.currentTimeMillis();

    GuiKeyEvent.Type type;
    if(entry.getTicks() < 0) { // initially pressed
        if(!down) return; // stop executing if key hasnt been initially pressed AND the key is being released (double release event)
        type = GuiKeyEvent.Type.PRESSED;
        entry.setTimePressed(currentTimeMS); // update last click time
    } else {
        type = down ? GuiKeyEvent.Type.DOWN : GuiKeyEvent.Type.RELEASED;
    }

    // update ticks
    entry.incrementTicks();

    element.onKeyEvent(new GuiKeyEvent(
            type,
            keyCode,
            entry.getTicks(),
            entry.getTime(),
            currentTimeMS - entry.getTimePressed())
    );

    if(type == GuiKeyEvent.Type.RELEASED) {
        entry.setTime(entry.getTimePressed());
        entry.setTimePressed(-1);
        entry.resetTicks(); // reset ticks after event
    }

    super.handleKeyboardInput();
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:43,代碼來源:MinecraftGuiProxy.java

示例15: ScreenEffect

public ScreenEffect() {
	super("ScreenEffect", Keyboard.KEY_NONE, Category.RENDER, false);

	client.getManagers().getManager(SettingManager.class).addSetting(new Setting(this, "DamageEffect", true));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:5,代碼來源:ScreenEffect.java


注:本文中的org.lwjgl.input.Keyboard.KEY_NONE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。