本文整理了Java中org.lwjgl.input.Keyboard.getEventCharacter()
方法的一些代码示例,展示了Keyboard.getEventCharacter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyboard.getEventCharacter()
方法的具体详情如下:
包路径:org.lwjgl.input.Keyboard
类名称:Keyboard
方法名:getEventCharacter
暂无
代码示例来源:origin: MovingBlocks/Terasology
@Override
public Queue<KeyboardAction> getInputQueue() {
Queue<KeyboardAction> result = Queues.newArrayDeque();
while (Keyboard.next()) {
ButtonState state;
if (Keyboard.isRepeatEvent()) {
state = ButtonState.REPEAT;
} else {
state = (Keyboard.getEventKeyState()) ? ButtonState.DOWN : ButtonState.UP;
}
Input input = InputType.KEY.getInput(Keyboard.getEventKey());
result.add(new KeyboardAction(input, state, Keyboard.getEventCharacter()));
}
return result;
}
}
代码示例来源:origin: libgdx/libgdx
while (Keyboard.next()) {
int keyCode = getGdxKeyCode(Keyboard.getEventKey());
char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
long timeStamp = Keyboard.getEventNanoseconds();
代码示例来源:origin: libgdx/libgdx
while (Keyboard.next()) {
int keyCode = getGdxKeyCode(Keyboard.getEventKey());
char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
long timeStamp = Keyboard.getEventNanoseconds();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
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);
}
}
代码示例来源:origin: AntiqueAtlasTeam/AntiqueAtlas
/** Handle keyboard input for this GUI and its children. */
@Override
public void handleKeyboardInput() throws IOException {
boolean handled = false;
// Traverse children backwards, because the topmost child should be the
// first to process input:
ListIterator<GuiComponent> iter = children.listIterator(children.size());
while(iter.hasPrevious()) {
GuiComponent child = iter.previous();
child.handleKeyboardInput();
if (child.hasHandledKeyboard) {
child.hasHandledKeyboard = false;
handled = true;
}
}
if (!handled) {
if (Keyboard.getEventKeyState()) {
this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
}
}
}
代码示例来源:origin: mezz/JustEnoughItems
private boolean handleKeyEvent() {
char typedChar = Keyboard.getEventCharacter();
int eventKey = Keyboard.getEventKey();
return ((eventKey == 0 && typedChar >= 32) || Keyboard.getEventKeyState()) &&
handleKeyDown(typedChar, eventKey);
}
代码示例来源:origin: nifty-gui/nifty-gui
private void processKeyboardEvents(@Nonnull final NiftyInputConsumer inputEventConsumer) {
while (Keyboard.next()) {
KeyboardInputEvent event = keyboardEventCreator.createEvent(Keyboard.getEventKey(),
Keyboard.getEventCharacter(), Keyboard.getEventKeyState());
// due to or short-circuiting on true, the event will get forward to keyboardEventsOut if keyboardEventsOut=true
if (!niftyHasKeyboardFocus || !inputEventConsumer.processKeyboardEvent(event)) {
keyboardEventsOut.offer(event);
}
}
}
代码示例来源:origin: MrCrayfish/MrCrayfishDeviceMod
@Override
public void handleKeyboardInput() throws IOException
{
if (Keyboard.getEventKeyState())
{
char pressed = Keyboard.getEventCharacter();
int code = Keyboard.getEventKey();
if(windows[0] != null)
{
windows[0].handleKeyTyped(pressed, code);
}
super.keyTyped(pressed, code);
}
else
{
if(windows[0] != null)
{
windows[0].handleKeyReleased(Keyboard.getEventCharacter(), Keyboard.getEventKey());
}
}
this.mc.dispatchKeypresses();
}
代码示例来源:origin: SquidDev-CC/plethora
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onInputEvent(InputEvent.KeyInputEvent event) {
if (!listen) {
// If we're not listening then clear the lookup of keys which are down and exit.
keysDown.clear();
return;
}
if (Keyboard.getEventKeyState()) {
char ch = Keyboard.getEventCharacter();
int key = Keyboard.getEventKey();
boolean repeat = Keyboard.isRepeatEvent();
ch = ch >= 32 && ch <= 126 || ch >= 160 && ch <= 255 ? ch : '\0';
if (key > 0 || ch != '\0') {
keyPresses.add(new KeyPress(key, repeat, ch));
boolean found = false;
for (KeyDown down : keysDown) {
if (down.key == key) {
down.lastTime = Minecraft.getSystemTime();
found = true;
break;
}
}
if (!found) keysDown.add(new KeyDown(key, ch));
}
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public void handleKeyboardInput() throws IOException {
int key = Keyboard.getEventKey();
boolean state = Keyboard.getEventKeyState();
char ch = Keyboard.getEventCharacter();
ActivationEvent evt = new ActivationEvent(state ? Listener.KEY_DOWN : Listener.KEY_UP, key, ch, state);
for (GuiElement element : this.elements) {
element.handleKeyboardInput(evt);
}
if (selectedWidget == null) {
super.handleKeyboardInput();
}
}
代码示例来源:origin: com.ardor3d/ardor3d-lwjgl
@Override
protected KeyEvent computeNext() {
if (!Keyboard.next()) {
return endOfData();
}
final int keyCode = Keyboard.getEventKey();
final boolean pressed = Keyboard.getEventKeyState();
final char keyChar = Keyboard.getEventCharacter();
final Key k = LwjglKey.findByCode(keyCode);
return new KeyEvent(k, pressed ? KeyState.DOWN : KeyState.UP, keyChar);
}
}
代码示例来源:origin: Vazkii/Quark
@SubscribeEvent
public void onKeypress(GuiScreenEvent.KeyboardInputEvent.Pre event) {
if(searchBar != null && searchBar.isFocused() && Keyboard.getEventKeyState()) {
char eventChar = Keyboard.getEventCharacter();
int eventCode = Keyboard.getEventKey();
searchBar.textboxKeyTyped(eventChar, eventCode);
text = searchBar.getText();
event.setCanceled(eventCode != 1);
}
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl
while (Keyboard.next()) {
int keyCode = getGdxKeyCode(Keyboard.getEventKey());
char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
long timeStamp = Keyboard.getEventNanoseconds();
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl
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);
}
}
代码示例来源:origin: org.slick2d/slick2d-core
int eventKey = resolveEventKey(Keyboard.getEventKey(), Keyboard.getEventCharacter());
keys[eventKey] = Keyboard.getEventCharacter();
pressed[eventKey] = true;
nextRepeat[eventKey] = System.currentTimeMillis() + keyRepeatInitial;
listener.keyPressed(eventKey, Keyboard.getEventCharacter());
if (consumed) {
break;
int eventKey = resolveEventKey(Keyboard.getEventKey(), Keyboard.getEventCharacter());
nextRepeat[eventKey] = 0;
代码示例来源:origin: threerings/playn
@Override
void update() {
Modifiers modifiers = extractModifiers();
while (Keyboard.next()) {
double time = (double) (Keyboard.getEventNanoseconds() / 1000);
int keyCode = Keyboard.getEventKey();
if (Keyboard.getEventKeyState()) {
Key key = translateKey(keyCode);
if (key != null)
dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), down);
char keyChar = Keyboard.getEventCharacter();
if (!Character.isISOControl(keyChar))
dispatch(new TypedEvent.Impl(new Events.Flags.Impl(), time, keyChar), typed);
} else {
Key key = translateKey(keyCode);
if (key != null)
dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), up);
}
}
super.update();
}
代码示例来源:origin: com.googlecode.playn/playn-java
@Override
void update() {
Modifiers modifiers = extractModifiers();
while (Keyboard.next()) {
double time = (double) (Keyboard.getEventNanoseconds() / 1000);
int keyCode = Keyboard.getEventKey();
if (Keyboard.getEventKeyState()) {
Key key = translateKey(keyCode);
if (key != null)
dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), down);
char keyChar = Keyboard.getEventCharacter();
if (!Character.isISOControl(keyChar))
dispatch(new TypedEvent.Impl(new Events.Flags.Impl(), time, keyChar), typed);
} else {
Key key = translateKey(keyCode);
if (key != null)
dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), up);
}
}
super.update();
}
代码示例来源:origin: org.ode4j/demo
char keyChar = Keyboard.getEventCharacter();
if (keyChar >= ' ' && keyChar <= 126) fn.command (keyChar);
代码示例来源:origin: montoyo/mcef
char key = Keyboard.getEventCharacter();
int num = Keyboard.getEventKey();
代码示例来源:origin: playn/playn
Key key = translateKey(keyCode);
if (key != null) emitKeyPress(flags, time, key, true);
char keyChar = Keyboard.getEventCharacter();
if (!Character.isISOControl(keyChar)) emitKeyTyped(time, keyChar);
} else {
内容来源于网络,如有侵权,请联系作者删除!