Java Code Examples for org.lwjgl.input.Keyboard#getEventCharacter()
The following examples show how to use
org.lwjgl.input.Keyboard#getEventCharacter() .
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: KeybindButton.java From ClientBase with MIT License | 6 votes |
@Override public boolean keyPressed(int key, char c) { if (listening) { listening = false; if (Keyboard.getEventKey() != 256 && Keyboard.getEventCharacter() != 0) { int newValue = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); if (listener != null) if (listener.onValueChange(newValue)) this.value = newValue; } updateState(); } return super.keyPressed(key, c); }
Example 2
Source File: Game.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 6 votes |
/** * Gets the input. * * @return the input */ public static void getInput() { Keyboard.poll(); keys.clear(); while(Keyboard.next()) { KeyboardEvent ke = new KeyboardEvent(Keyboard.getEventKey(), Keyboard.getEventCharacter(), Keyboard.isRepeatEvent(), Keyboard.getEventKeyState(), KeyboardEvent.generateModifiers()); keys.add(ke); } Mouse.poll(); mouseEvents.clear(); while(Mouse.next()) { MouseEvent me = new MouseEvent( Mouse.getEventX(), Mouse.getEventY(), Mouse.getEventDWheel(), Mouse.getEventButton(), Mouse.getEventButtonState()); mouseEvents.add(me); } }
Example 3
Source File: LwjglKeyInput.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void update() { if (!context.isRenderable()) return; Keyboard.poll(); while (Keyboard.next()){ int keyCode = Keyboard.getEventKey(); char keyChar = Keyboard.getEventCharacter(); boolean pressed = Keyboard.getEventKeyState(); boolean down = Keyboard.isRepeatEvent(); long time = Keyboard.getEventNanoseconds(); KeyInputEvent evt = new KeyInputEvent(keyCode, keyChar, pressed, down); evt.setTime(time); listener.onKeyEvent(evt); } }
Example 4
Source File: GuiScreenPlus.java From Chisel with GNU General Public License v2.0 | 6 votes |
@Override public void handleKeyboardInput() { keyboardEvent.handled = false; if(Keyboard.getEventKeyState()) { keyboardEvent.key = Keyboard.getEventKey(); keyboardEvent.character = Keyboard.getEventCharacter(); switch(keyboardEvent.key) { case 1: break; default: root.keyPressed(keyboardEvent); } } if(!keyboardEvent.handled) { super.handleKeyboardInput(); } }
Example 5
Source File: Game.java From FEMultiplayer with GNU General Public License v3.0 | 6 votes |
public static void getInput() { Keyboard.poll(); keys.clear(); while(Keyboard.next()) { KeyboardEvent ke = new KeyboardEvent( Keyboard.getEventKey(), Keyboard.getEventCharacter(), Keyboard.isRepeatEvent(), Keyboard.getEventKeyState()); keys.add(ke); } Mouse.poll(); mouseEvents.clear(); while(Mouse.next()) { MouseEvent me = new MouseEvent( Mouse.getEventX(), Mouse.getEventY(), Mouse.getEventDWheel(), Mouse.getEventButton(), Mouse.getEventButtonState()); mouseEvents.add(me); } }
Example 6
Source File: LwjglKeyInput.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void update() { if (!context.isRenderable()) return; Keyboard.poll(); while (Keyboard.next()){ int keyCode = Keyboard.getEventKey(); char keyChar = Keyboard.getEventCharacter(); boolean pressed = Keyboard.getEventKeyState(); boolean down = Keyboard.isRepeatEvent(); long time = Keyboard.getEventNanoseconds(); KeyInputEvent evt = new KeyInputEvent(keyCode, keyChar, pressed, down); evt.setTime(time); listener.onKeyEvent(evt); } }
Example 7
Source File: CommandsModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
@Listener public void keyPress(EventKeyPress event) { if(this.prefix.getValue().length() == 1) { final char key = Keyboard.getEventCharacter(); if(this.prefix.getValue().charAt(0) == key) { Minecraft.getMinecraft().displayGuiScreen(new GuiChat()); } } }
Example 8
Source File: MixinGuiScreen.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
/** * @author SiroQ * @reason Fix input bug (MC-2781) **/ @Overwrite public void handleKeyboardInput() throws IOException { char character = Keyboard.getEventCharacter(); if (Keyboard.getEventKey() == 0 && character >= 32 || Keyboard.getEventKeyState()) { keyTyped(character, Keyboard.getEventKey()); } mc.dispatchKeypresses(); }
Example 9
Source File: NEIClientEventHandler.java From NotEnoughItems with MIT License | 5 votes |
@SubscribeEvent public void onKeyTypedPost(KeyboardInputEvent.Post event) { GuiScreen gui = event.getGui(); if (gui instanceof GuiContainer) { char c = Keyboard.getEventCharacter(); int eventKey = Keyboard.getEventKey(); if (eventKey == 0 && c >= 32 || Keyboard.getEventKeyState()) { if (eventKey != 1) { for (IInputHandler inputhander : inputHandlers) { if (inputhander.lastKeyTyped(gui, c, eventKey)) { event.setCanceled(true); return; } } } if (KeyBindings.get("nei.options.keys.gui.enchant").isActiveAndMatches(eventKey) && canPerformAction("enchant")) { NEIClientPacketHandler.sendOpenEnchantmentWindow(); event.setCanceled(true); } if (KeyBindings.get("nei.options.keys.gui.potion").isActiveAndMatches(eventKey) && canPerformAction("potion")) { NEIClientPacketHandler.sendOpenPotionWindow(); event.setCanceled(true); } } } }
Example 10
Source File: GuiContainerManager.java From NotEnoughItems with MIT License | 5 votes |
public void handleKeyboardInput() { // Support for LWGJL 2.9.0 or later int k = Keyboard.getEventKey(); char c = Keyboard.getEventCharacter(); if (Keyboard.getEventKeyState() || (k == 0 && Character.isDefined(c))) keyTyped(c, k); window.mc.dispatchKeypresses(); }
Example 11
Source File: ClientProxy.java From IGW-mod with GNU General Public License v2.0 | 5 votes |
@SubscribeEvent public void onGuiKeyBind(GuiScreenEvent.KeyboardInputEvent.Post event){ char chr = Keyboard.getEventCharacter(); int key = Keyboard.getEventKey(); if(((key == 0 && chr >= 32) || Keyboard.getEventKeyState()) && key == openInterfaceKey.getKeyCode()) { handleSlotPresses(); } }