()
| 43 | } |
| 44 | |
| 45 | private void HandleEvents() |
| 46 | { |
| 47 | Keyboard.poll(); |
| 48 | |
| 49 | if (Display.isCloseRequested()) |
| 50 | { |
| 51 | Cmd.ExecuteString("quit"); |
| 52 | } |
| 53 | |
| 54 | while (Keyboard.next()) |
| 55 | { |
| 56 | int key = Keyboard.getEventKey(); |
| 57 | char ch = Keyboard.getEventCharacter(); |
| 58 | boolean down = Keyboard.getEventKeyState(); |
| 59 | |
| 60 | // fill the character translation table |
| 61 | // this is needed because the getEventCharacter() returns \0 if a key is released |
| 62 | // keycode is correct but the charachter value is not |
| 63 | if (down) { |
| 64 | lwjglKeycodeMap[key] = ch; |
| 65 | pressed[key] = Globals.sys_frame_time; |
| 66 | } else { |
| 67 | pressed[key] = 0; |
| 68 | } |
| 69 | |
| 70 | Do_Key_Event(XLateKey(key,ch), down); |
| 71 | } |
| 72 | |
| 73 | // fixme: has a bug with repeating underscore character |
| 74 | // generateRepeats(); |
| 75 | |
| 76 | if (IN.mouse_active) |
| 77 | { |
| 78 | mx = Mouse.getDX() << 1; |
| 79 | my = -Mouse.getDY() << 1; |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | mx=0; |
| 84 | my=0; |
| 85 | } |
| 86 | |
| 87 | while (Mouse.next()) { |
| 88 | int button = Mouse.getEventButton(); |
| 89 | if (button >= 0) { |
| 90 | Do_Key_Event(Key.K_MOUSE1 + button, Mouse.getEventButtonState()); |
| 91 | } else { |
| 92 | button = Mouse.getEventDWheel(); |
| 93 | if (button > 0) { |
| 94 | Do_Key_Event(Key.K_MWHEELUP, true); |
| 95 | Do_Key_Event(Key.K_MWHEELUP, false); |
| 96 | } else if (button < 0) { |
| 97 | Do_Key_Event(Key.K_MWHEELDOWN, true); |
| 98 | Do_Key_Event(Key.K_MWHEELDOWN, false); |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
no test coverage detected