OSDN Git Service

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