本文整理汇总了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);
}
}
示例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;
}
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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));
}
示例13: Module
public Module(String name, String description) {
this(name, description, Keyboard.KEY_NONE);
}
示例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();
}
示例15: ScreenEffect
public ScreenEffect() {
super("ScreenEffect", Keyboard.KEY_NONE, Category.RENDER, false);
client.getManagers().getManager(SettingManager.class).addSetting(new Setting(this, "DamageEffect", true));
}