2 * Sixth 3D engine. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.sixth.e3d.gui.humaninput;
7 import java.awt.event.InputEvent;
8 import java.util.HashSet;
11 public class KeyboardHelper {
13 public static final int TAB = 9;
14 public static final int DOWN = 40;
15 public static final int UP = 38;
16 public static final int RIGHT = 39;
17 public static final int LEFT = 37;
18 public static final int PGDOWN = 34;
19 public static final int PGUP = 33;
20 public static final int HOME = 36;
21 public static final int END = 35;
22 public static final int DEL = 127;
23 public static final int ENTER = 10;
24 public static final int BACKSPACE = 8;
25 public static final int ESC = 27;
26 public static final int SHIFT = 16;
28 private static final Set<Integer> nonText;
31 nonText = new HashSet<>();
41 public static boolean isAltPressed(final int modifiersEx) {
42 return (modifiersEx | InputEvent.ALT_DOWN_MASK) == modifiersEx;
45 public static boolean isCtrlPressed(final int modifiersEx) {
46 return (modifiersEx | InputEvent.CTRL_DOWN_MASK) == modifiersEx;
49 public static boolean isShiftPressed(final int modifiersEx) {
50 return (modifiersEx | InputEvent.SHIFT_DOWN_MASK) == modifiersEx;
53 public static boolean isText(final int keyCode) {
54 return !nonText.contains(keyCode);