OSDN Git Service

GLFW backend works! Yay!
[mikumikustudio/libgdx-mikumikustudio.git] / backends / gdx-backend-jglfw / src / com / badlogic / gdx / backends / jglfw / JglfwInput.java
1
2 package com.badlogic.gdx.backends.jglfw;
3
4 import static com.badlogic.jglfw.Glfw.*;
5
6 import com.badlogic.gdx.Gdx;
7 import com.badlogic.gdx.Input;
8 import com.badlogic.gdx.InputProcessor;
9 import com.badlogic.gdx.utils.GdxRuntimeException;
10 import com.badlogic.jglfw.GlfwCallback;
11
12 import java.awt.Color;
13 import java.awt.FlowLayout;
14 import java.awt.event.WindowEvent;
15 import java.awt.event.WindowFocusListener;
16
17 import javax.swing.JDialog;
18 import javax.swing.JLabel;
19 import javax.swing.JOptionPane;
20 import javax.swing.JPanel;
21 import javax.swing.JTextField;
22 import javax.swing.OverlayLayout;
23 import javax.swing.SwingUtilities;
24 import javax.swing.border.EmptyBorder;
25 import javax.swing.event.DocumentEvent;
26 import javax.swing.event.DocumentListener;
27
28 /** An implementation of the {@link Input} interface hooking GLFW panel for input.
29  * @author mzechner
30  * @author Nathan Sweet */
31 public class JglfwInput implements Input {
32         JglfwGraphics graphics;
33         InputProcessor processor;
34         int pressedKeys = 0;
35         boolean justTouched = false;
36         long currentEventTimeStamp;
37         int deltaX, deltaY;
38
39         public JglfwInput (JglfwGraphics graphics) {
40                 this.graphics = graphics;
41
42                 glfwSetCallback(new GlfwCallback() {
43                         private int mouseX, mouseY, mousePressed;
44                         private char lastCharacter;
45
46                         public void key (long window, int key, int action) {
47                                 switch (action) {
48                                 case GLFW_PRESS:
49                                         if (processor != null) processor.keyDown(getGdxKeyCode(key));
50                                         break;
51                                 case GLFW_RELEASE:
52                                         if (processor != null) processor.keyDown(getGdxKeyCode(key));
53                                         break;
54                                 case GLFW_REPEAT:
55                                         if (processor != null && lastCharacter != 0) processor.keyTyped(lastCharacter);
56                                         break;
57                                 }
58                         }
59
60                         public void character (long window, char character) {
61                                 lastCharacter = character;
62                                 if (processor != null) processor.keyTyped(character);
63                         }
64
65                         public void scroll (long window, double scrollX, double scrollY) {
66                                 if (processor != null) processor.scrolled((int)-Math.signum(scrollY));
67                         }
68
69                         public void mouseButton (long window, int button, boolean pressed) {
70                                 if (pressed) {
71                                         mousePressed++;
72                                         if (processor != null) processor.touchDown(mouseX, mouseY, 0, button);
73                                 } else {
74                                         mousePressed--;
75                                         if (processor != null) processor.touchUp(mouseX, mouseY, 0, button);
76                                 }
77                         }
78
79                         public void cursorPos (long window, int x, int y) {
80                                 mouseX = x;
81                                 mouseY = y;
82                                 if (processor != null) {
83                                         if (mousePressed > 0)
84                                                 processor.touchDragged(mouseX, mouseY, 0);
85                                         else
86                                                 processor.mouseMoved(mouseX, mouseY);
87                                 }
88                         }
89
90                         public void cursorEnter (long window, boolean entered) {
91                         }
92
93                         public void windowSize (long window, int width, int height) {
94                         }
95
96                         public void windowRefresh (long window) {
97                         }
98
99                         public void windowPos (long window, int x, int y) {
100                         }
101
102                         public void windowIconify (long window, boolean iconified) {
103                         }
104
105                         public void windowFocus (long window, boolean focused) {
106                         }
107
108                         public boolean windowClose (long window) {
109                                 return true;
110                         }
111
112                         public void monitor (long monitor, boolean connected) {
113                         }
114
115                         public void error (int error, String description) {
116                                 throw new GdxRuntimeException("GLFW error " + error + ": " + description);
117                         }
118                 });
119         }
120
121         public float getAccelerometerX () {
122                 return 0;
123         }
124
125         public float getAccelerometerY () {
126                 return 0;
127         }
128
129         public float getAccelerometerZ () {
130                 return 0;
131         }
132
133         public int getX () {
134                 return glfwGetCursorPosX(graphics.window);
135         }
136
137         public int getX (int pointer) {
138                 if (pointer > 0)
139                         return 0;
140                 else
141                         return getX();
142         }
143
144         public int getY () {
145                 return graphics.getHeight() - 1 - glfwGetCursorPosY(graphics.window);
146         }
147
148         public int getY (int pointer) {
149                 if (pointer > 0)
150                         return 0;
151                 else
152                         return getY();
153         }
154
155         public int getDeltaX () {
156                 return deltaX;
157         }
158
159         public int getDeltaX (int pointer) {
160                 if (pointer > 0)
161                         return 0;
162                 else
163                         return deltaX;
164         }
165
166         public int getDeltaY () {
167                 return deltaY;
168         }
169
170         public int getDeltaY (int pointer) {
171                 if (pointer > 0)
172                         return 0;
173                 else
174                         return deltaY;
175         }
176
177         public boolean isTouched () {
178                 return glfwGetMouseButton(graphics.window, 0) || glfwGetMouseButton(graphics.window, 1)
179                         || glfwGetMouseButton(graphics.window, 2);
180         }
181
182         public boolean justTouched () {
183                 return justTouched;
184         }
185
186         public boolean isTouched (int pointer) {
187                 if (pointer > 0)
188                         return false;
189                 else
190                         return isTouched();
191         }
192
193         public boolean isButtonPressed (int button) {
194                 return glfwGetMouseButton(graphics.window, button);
195         }
196
197         public boolean isKeyPressed (int key) {
198                 if (key == Input.Keys.ANY_KEY)
199                         return pressedKeys > 0;
200                 else
201                         return glfwGetKey(graphics.window, key);
202         }
203
204         public void getTextInput (final TextInputListener listener, final String title, final String text) {
205                 SwingUtilities.invokeLater(new Runnable() {
206                         public void run () {
207                                 final String output = JOptionPane.showInputDialog(null, title, text);
208                                 Gdx.app.postRunnable(new Runnable() {
209                                         public void run () {
210                                                 if (output != null)
211                                                         listener.input(output);
212                                                 else
213                                                         listener.canceled();
214                                         }
215                                 });
216                         }
217                 });
218         }
219
220         public void getPlaceholderTextInput (final TextInputListener listener, final String title, final String placeholder) {
221                 SwingUtilities.invokeLater(new Runnable() {
222                         public void run () {
223                                 JPanel panel = new JPanel(new FlowLayout());
224
225                                 JPanel textPanel = new JPanel() {
226                                         public boolean isOptimizedDrawingEnabled () {
227                                                 return false;
228                                         };
229                                 };
230                                 textPanel.setLayout(new OverlayLayout(textPanel));
231                                 panel.add(textPanel);
232
233                                 final JTextField textField = new JTextField(20);
234                                 textField.setAlignmentX(0.0f);
235                                 textPanel.add(textField);
236
237                                 final JLabel placeholderLabel = new JLabel(placeholder);
238                                 placeholderLabel.setForeground(Color.GRAY);
239                                 placeholderLabel.setAlignmentX(0.0f);
240                                 textPanel.add(placeholderLabel, 0);
241
242                                 textField.getDocument().addDocumentListener(new DocumentListener() {
243                                         public void removeUpdate (DocumentEvent event) {
244                                                 this.updated();
245                                         }
246
247                                         public void insertUpdate (DocumentEvent event) {
248                                                 this.updated();
249                                         }
250
251                                         public void changedUpdate (DocumentEvent event) {
252                                                 this.updated();
253                                         }
254
255                                         private void updated () {
256                                                 placeholderLabel.setVisible(textField.getText().length() == 0);
257                                         }
258                                 });
259
260                                 JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,
261                                         null);
262                                 pane.setComponentOrientation(JOptionPane.getRootFrame().getComponentOrientation());
263                                 pane.selectInitialValue();
264
265                                 placeholderLabel.setBorder(new EmptyBorder(textField.getBorder().getBorderInsets(textField)));
266
267                                 JDialog dialog = pane.createDialog(null, title);
268                                 dialog.addWindowFocusListener(new WindowFocusListener() {
269                                         public void windowLostFocus (WindowEvent arg0) {
270                                         }
271
272                                         public void windowGainedFocus (WindowEvent arg0) {
273                                                 textField.requestFocusInWindow();
274                                         }
275                                 });
276                                 dialog.setVisible(true);
277                                 dialog.dispose();
278
279                                 Object selectedValue = pane.getValue();
280                                 if (selectedValue != null && (selectedValue instanceof Integer) && (Integer)selectedValue == JOptionPane.OK_OPTION)
281                                         listener.input(textField.getText());
282                                 else
283                                         listener.canceled();
284                         }
285                 });
286         }
287
288         public void setOnscreenKeyboardVisible (boolean visible) {
289         }
290
291         public void vibrate (int milliseconds) {
292         }
293
294         public void vibrate (long[] pattern, int repeat) {
295         }
296
297         public void cancelVibrate () {
298         }
299
300         public float getAzimuth () {
301                 return 0;
302         }
303
304         public float getPitch () {
305                 return 0;
306         }
307
308         public float getRoll () {
309                 return 0;
310         }
311
312         public void getRotationMatrix (float[] matrix) {
313         }
314
315         public long getCurrentEventTime () {
316                 return currentEventTimeStamp;
317         }
318
319         public void setCatchBackKey (boolean catchBack) {
320         }
321
322         public void setCatchMenuKey (boolean catchMenu) {
323         }
324
325         public void setInputProcessor (InputProcessor processor) {
326                 this.processor = processor;
327         }
328
329         public InputProcessor getInputProcessor () {
330                 return processor;
331         }
332
333         public boolean isPeripheralAvailable (Peripheral peripheral) {
334                 if (peripheral == Peripheral.HardwareKeyboard) return true;
335                 return false;
336         }
337
338         public int getRotation () {
339                 return 0;
340         }
341
342         public Orientation getNativeOrientation () {
343                 return Orientation.Landscape;
344         }
345
346         public void setCursorCatched (boolean captured) {
347                 glfwSetInputMode(graphics.window, GLFW_CURSOR_MODE, captured ? GLFW_CURSOR_CAPTURED : GLFW_CURSOR_NORMAL);
348         }
349
350         public boolean isCursorCatched () {
351                 return glfwGetInputMode(graphics.window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED;
352         }
353
354         public void setCursorPosition (int x, int y) {
355                 glfwSetCursorPos(graphics.window, x, y);
356         }
357
358         public static int getGdxKeyCode (int lwjglKeyCode) {
359                 switch (lwjglKeyCode) {
360                 case GLFW_KEY_LEFT_BRACKET:
361                         return Input.Keys.LEFT_BRACKET;
362                 case GLFW_KEY_RIGHT_BRACKET:
363                         return Input.Keys.RIGHT_BRACKET;
364                 case GLFW_KEY_GRAVE_ACCENT:
365                         return Input.Keys.GRAVE;
366                 case GLFW_KEY_KP_MULTIPLY:
367                         return Input.Keys.STAR;
368                 case GLFW_KEY_NUM_LOCK:
369                         return Input.Keys.NUM;
370                 case GLFW_KEY_KP_DECIMAL:
371                         return Input.Keys.PERIOD;
372                 case GLFW_KEY_KP_DIVIDE:
373                         return Input.Keys.SLASH;
374                 case GLFW_KEY_MENU:
375                         return Input.Keys.SYM;
376                 case GLFW_KEY_KP_EQUAL:
377                         return Input.Keys.EQUALS;
378                 case GLFW_KEY_EQUAL:
379                         return Input.Keys.EQUALS;
380                 case GLFW_KEY_KP_ENTER:
381                         return Input.Keys.ENTER;
382                 case GLFW_KEY_0:
383                         return Input.Keys.NUM_0;
384                 case GLFW_KEY_1:
385                         return Input.Keys.NUM_1;
386                 case GLFW_KEY_2:
387                         return Input.Keys.NUM_2;
388                 case GLFW_KEY_3:
389                         return Input.Keys.NUM_3;
390                 case GLFW_KEY_4:
391                         return Input.Keys.NUM_4;
392                 case GLFW_KEY_5:
393                         return Input.Keys.NUM_5;
394                 case GLFW_KEY_6:
395                         return Input.Keys.NUM_6;
396                 case GLFW_KEY_7:
397                         return Input.Keys.NUM_7;
398                 case GLFW_KEY_8:
399                         return Input.Keys.NUM_8;
400                 case GLFW_KEY_9:
401                         return Input.Keys.NUM_9;
402                 case GLFW_KEY_A:
403                         return Input.Keys.A;
404                 case GLFW_KEY_B:
405                         return Input.Keys.B;
406                 case GLFW_KEY_C:
407                         return Input.Keys.C;
408                 case GLFW_KEY_D:
409                         return Input.Keys.D;
410                 case GLFW_KEY_E:
411                         return Input.Keys.E;
412                 case GLFW_KEY_F:
413                         return Input.Keys.F;
414                 case GLFW_KEY_G:
415                         return Input.Keys.G;
416                 case GLFW_KEY_H:
417                         return Input.Keys.H;
418                 case GLFW_KEY_I:
419                         return Input.Keys.I;
420                 case GLFW_KEY_J:
421                         return Input.Keys.J;
422                 case GLFW_KEY_K:
423                         return Input.Keys.K;
424                 case GLFW_KEY_L:
425                         return Input.Keys.L;
426                 case GLFW_KEY_M:
427                         return Input.Keys.M;
428                 case GLFW_KEY_N:
429                         return Input.Keys.N;
430                 case GLFW_KEY_O:
431                         return Input.Keys.O;
432                 case GLFW_KEY_P:
433                         return Input.Keys.P;
434                 case GLFW_KEY_Q:
435                         return Input.Keys.Q;
436                 case GLFW_KEY_R:
437                         return Input.Keys.R;
438                 case GLFW_KEY_S:
439                         return Input.Keys.S;
440                 case GLFW_KEY_T:
441                         return Input.Keys.T;
442                 case GLFW_KEY_U:
443                         return Input.Keys.U;
444                 case GLFW_KEY_V:
445                         return Input.Keys.V;
446                 case GLFW_KEY_W:
447                         return Input.Keys.W;
448                 case GLFW_KEY_X:
449                         return Input.Keys.X;
450                 case GLFW_KEY_Y:
451                         return Input.Keys.Y;
452                 case GLFW_KEY_Z:
453                         return Input.Keys.Z;
454                 case GLFW_KEY_LALT:
455                         return Input.Keys.ALT_LEFT;
456                 case GLFW_KEY_RALT:
457                         return Input.Keys.ALT_RIGHT;
458                 case GLFW_KEY_BACKSLASH:
459                         return Input.Keys.BACKSLASH;
460                 case GLFW_KEY_COMMA:
461                         return Input.Keys.COMMA;
462                 case GLFW_KEY_DELETE:
463                         return Input.Keys.FORWARD_DEL;
464                 case GLFW_KEY_LEFT:
465                         return Input.Keys.DPAD_LEFT;
466                 case GLFW_KEY_RIGHT:
467                         return Input.Keys.DPAD_RIGHT;
468                 case GLFW_KEY_UP:
469                         return Input.Keys.DPAD_UP;
470                 case GLFW_KEY_DOWN:
471                         return Input.Keys.DPAD_DOWN;
472                 case GLFW_KEY_ENTER:
473                         return Input.Keys.ENTER;
474                 case GLFW_KEY_HOME:
475                         return Input.Keys.HOME;
476                 case GLFW_KEY_MINUS:
477                         return Input.Keys.MINUS;
478                 case GLFW_KEY_PERIOD:
479                         return Input.Keys.PERIOD;
480                 case GLFW_KEY_KP_ADD:
481                         return Input.Keys.PLUS;
482                 case GLFW_KEY_SEMICOLON:
483                         return Input.Keys.SEMICOLON;
484                 case GLFW_KEY_LSHIFT:
485                         return Input.Keys.SHIFT_LEFT;
486                 case GLFW_KEY_RSHIFT:
487                         return Input.Keys.SHIFT_RIGHT;
488                 case GLFW_KEY_SLASH:
489                         return Input.Keys.SLASH;
490                 case GLFW_KEY_SPACE:
491                         return Input.Keys.SPACE;
492                 case GLFW_KEY_TAB:
493                         return Input.Keys.TAB;
494                 case GLFW_KEY_LEFT_CONTROL:
495                         return Input.Keys.CONTROL_LEFT;
496                 case GLFW_KEY_RIGHT_CONTROL:
497                         return Input.Keys.CONTROL_RIGHT;
498                 case GLFW_KEY_ESCAPE:
499                         return Input.Keys.ESCAPE;
500                 case GLFW_KEY_END:
501                         return Input.Keys.END;
502                 case GLFW_KEY_INSERT:
503                         return Input.Keys.INSERT;
504                 case GLFW_KEY_BACKSPACE:
505                         return Input.Keys.DEL;
506                 case GLFW_KEY_KP_SUBTRACT:
507                         return Input.Keys.MINUS;
508                 case GLFW_KEY_APOSTROPHE:
509                         return Input.Keys.APOSTROPHE;
510                 case GLFW_KEY_F1:
511                         return Input.Keys.F1;
512                 case GLFW_KEY_F2:
513                         return Input.Keys.F2;
514                 case GLFW_KEY_F3:
515                         return Input.Keys.F3;
516                 case GLFW_KEY_F4:
517                         return Input.Keys.F4;
518                 case GLFW_KEY_F5:
519                         return Input.Keys.F5;
520                 case GLFW_KEY_F6:
521                         return Input.Keys.F6;
522                 case GLFW_KEY_F7:
523                         return Input.Keys.F7;
524                 case GLFW_KEY_F8:
525                         return Input.Keys.F8;
526                 case GLFW_KEY_F9:
527                         return Input.Keys.F9;
528                 case GLFW_KEY_F10:
529                         return Input.Keys.F10;
530                 case GLFW_KEY_F11:
531                         return Input.Keys.F11;
532                 case GLFW_KEY_F12:
533                         return Input.Keys.F12;
534                 case GLFW_KEY_KP_0:
535                         return Input.Keys.NUM_0;
536                 case GLFW_KEY_KP_1:
537                         return Input.Keys.NUM_1;
538                 case GLFW_KEY_KP_2:
539                         return Input.Keys.NUM_2;
540                 case GLFW_KEY_KP_3:
541                         return Input.Keys.NUM_3;
542                 case GLFW_KEY_KP_4:
543                         return Input.Keys.NUM_4;
544                 case GLFW_KEY_KP_5:
545                         return Input.Keys.NUM_5;
546                 case GLFW_KEY_KP_6:
547                         return Input.Keys.NUM_6;
548                 case GLFW_KEY_KP_7:
549                         return Input.Keys.NUM_7;
550                 case GLFW_KEY_KP_8:
551                         return Input.Keys.NUM_8;
552                 case GLFW_KEY_KP_9:
553                         return Input.Keys.NUM_9;
554                 default:
555                         return Input.Keys.UNKNOWN;
556                 }
557         }
558
559         public static int getJglfwKeyCode (int gdxKeyCode) {
560                 switch (gdxKeyCode) {
561                 case Input.Keys.LEFT_BRACKET:
562                         return GLFW_KEY_LEFT_BRACKET;
563                 case Input.Keys.RIGHT_BRACKET:
564                         return GLFW_KEY_RIGHT_BRACKET;
565                 case Input.Keys.GRAVE:
566                         return GLFW_KEY_GRAVE_ACCENT;
567                 case Input.Keys.STAR:
568                         return GLFW_KEY_KP_MULTIPLY;
569                 case Input.Keys.NUM:
570                         return GLFW_KEY_NUM_LOCK;
571                 case Input.Keys.EQUALS:
572                         return GLFW_KEY_MENU;
573                 case Input.Keys.SYM:
574                         return GLFW_KEY_MENU;
575                 case Input.Keys.NUM_0:
576                         return GLFW_KEY_0;
577                 case Input.Keys.NUM_1:
578                         return GLFW_KEY_1;
579                 case Input.Keys.NUM_2:
580                         return GLFW_KEY_2;
581                 case Input.Keys.NUM_3:
582                         return GLFW_KEY_3;
583                 case Input.Keys.NUM_4:
584                         return GLFW_KEY_4;
585                 case Input.Keys.NUM_5:
586                         return GLFW_KEY_5;
587                 case Input.Keys.NUM_6:
588                         return GLFW_KEY_6;
589                 case Input.Keys.NUM_7:
590                         return GLFW_KEY_7;
591                 case Input.Keys.NUM_8:
592                         return GLFW_KEY_8;
593                 case Input.Keys.NUM_9:
594                         return GLFW_KEY_9;
595                 case Input.Keys.A:
596                         return GLFW_KEY_A;
597                 case Input.Keys.B:
598                         return GLFW_KEY_B;
599                 case Input.Keys.C:
600                         return GLFW_KEY_C;
601                 case Input.Keys.D:
602                         return GLFW_KEY_D;
603                 case Input.Keys.E:
604                         return GLFW_KEY_E;
605                 case Input.Keys.F:
606                         return GLFW_KEY_F;
607                 case Input.Keys.G:
608                         return GLFW_KEY_G;
609                 case Input.Keys.H:
610                         return GLFW_KEY_H;
611                 case Input.Keys.I:
612                         return GLFW_KEY_I;
613                 case Input.Keys.J:
614                         return GLFW_KEY_J;
615                 case Input.Keys.K:
616                         return GLFW_KEY_K;
617                 case Input.Keys.L:
618                         return GLFW_KEY_L;
619                 case Input.Keys.M:
620                         return GLFW_KEY_M;
621                 case Input.Keys.N:
622                         return GLFW_KEY_N;
623                 case Input.Keys.O:
624                         return GLFW_KEY_O;
625                 case Input.Keys.P:
626                         return GLFW_KEY_P;
627                 case Input.Keys.Q:
628                         return GLFW_KEY_Q;
629                 case Input.Keys.R:
630                         return GLFW_KEY_R;
631                 case Input.Keys.S:
632                         return GLFW_KEY_S;
633                 case Input.Keys.T:
634                         return GLFW_KEY_T;
635                 case Input.Keys.U:
636                         return GLFW_KEY_U;
637                 case Input.Keys.V:
638                         return GLFW_KEY_V;
639                 case Input.Keys.W:
640                         return GLFW_KEY_W;
641                 case Input.Keys.X:
642                         return GLFW_KEY_X;
643                 case Input.Keys.Y:
644                         return GLFW_KEY_Y;
645                 case Input.Keys.Z:
646                         return GLFW_KEY_Z;
647                 case Input.Keys.ALT_LEFT:
648                         return GLFW_KEY_LALT;
649                 case Input.Keys.ALT_RIGHT:
650                         return GLFW_KEY_RALT;
651                 case Input.Keys.BACKSLASH:
652                         return GLFW_KEY_BACKSLASH;
653                 case Input.Keys.COMMA:
654                         return GLFW_KEY_COMMA;
655                 case Input.Keys.FORWARD_DEL:
656                         return GLFW_KEY_DELETE;
657                 case Input.Keys.DPAD_LEFT:
658                         return GLFW_KEY_LEFT;
659                 case Input.Keys.DPAD_RIGHT:
660                         return GLFW_KEY_RIGHT;
661                 case Input.Keys.DPAD_UP:
662                         return GLFW_KEY_UP;
663                 case Input.Keys.DPAD_DOWN:
664                         return GLFW_KEY_DOWN;
665                 case Input.Keys.ENTER:
666                         return GLFW_KEY_ENTER;
667                 case Input.Keys.HOME:
668                         return GLFW_KEY_HOME;
669                 case Input.Keys.MINUS:
670                         return GLFW_KEY_MINUS;
671                 case Input.Keys.PERIOD:
672                         return GLFW_KEY_PERIOD;
673                 case Input.Keys.PLUS:
674                         return GLFW_KEY_KP_ADD;
675                 case Input.Keys.SEMICOLON:
676                         return GLFW_KEY_SEMICOLON;
677                 case Input.Keys.SHIFT_LEFT:
678                         return GLFW_KEY_LSHIFT;
679                 case Input.Keys.SHIFT_RIGHT:
680                         return GLFW_KEY_RSHIFT;
681                 case Input.Keys.SLASH:
682                         return GLFW_KEY_SLASH;
683                 case Input.Keys.SPACE:
684                         return GLFW_KEY_SPACE;
685                 case Input.Keys.TAB:
686                         return GLFW_KEY_TAB;
687                 case Input.Keys.DEL:
688                         return GLFW_KEY_BACKSPACE;
689                 case Input.Keys.CONTROL_LEFT:
690                         return GLFW_KEY_LEFT_CONTROL;
691                 case Input.Keys.CONTROL_RIGHT:
692                         return GLFW_KEY_RIGHT_CONTROL;
693                 case Input.Keys.ESCAPE:
694                         return GLFW_KEY_ESCAPE;
695                 case Input.Keys.F1:
696                         return GLFW_KEY_F1;
697                 case Input.Keys.F2:
698                         return GLFW_KEY_F2;
699                 case Input.Keys.F3:
700                         return GLFW_KEY_F3;
701                 case Input.Keys.F4:
702                         return GLFW_KEY_F4;
703                 case Input.Keys.F5:
704                         return GLFW_KEY_F5;
705                 case Input.Keys.F6:
706                         return GLFW_KEY_F6;
707                 case Input.Keys.F7:
708                         return GLFW_KEY_F7;
709                 case Input.Keys.F8:
710                         return GLFW_KEY_F8;
711                 case Input.Keys.F9:
712                         return GLFW_KEY_F9;
713                 case Input.Keys.F10:
714                         return GLFW_KEY_F10;
715                 case Input.Keys.F11:
716                         return GLFW_KEY_F11;
717                 case Input.Keys.F12:
718                         return GLFW_KEY_F12;
719                 default:
720                         return 0;
721                 }
722         }
723 }