MCPcopy Create free account
hub / github.com/demoth/jake2 / HandleEvents

Method HandleEvents

client/src/main/java/jake2/client/LWJGLKBD.java:45–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 }

Callers 1

UpdateMethod · 0.95

Calls 4

ExecuteStringMethod · 0.95
Do_Key_EventMethod · 0.95
XLateKeyMethod · 0.95
nextMethod · 0.80

Tested by

no test coverage detected