当前位置: 首页>>代码示例>>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;未经允许,请勿转载。