OSDN Git Service

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