Skip to content

Commit

Permalink
Merge pull request #446 from JD557/more-keys
Browse files Browse the repository at this point in the history
Add more keys
  • Loading branch information
JD557 authored Nov 19, 2023
2 parents ce3a44d + 6b94a3a commit 6a577b3
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,45 @@ import eu.joaocosta.minart.input.KeyboardInput.*
*/
object JsKeyMapping extends KeyMapping[Int] {
protected val mappings: Map[Int, Key] = Map(
65 -> Key.A,
66 -> Key.B,
67 -> Key.C,
68 -> Key.D,
69 -> Key.E,
70 -> Key.F,
71 -> Key.G,
72 -> Key.H,
73 -> Key.I,
74 -> Key.J,
75 -> Key.K,
76 -> Key.L,
77 -> Key.M,
78 -> Key.N,
79 -> Key.O,
80 -> Key.P,
81 -> Key.Q,
82 -> Key.R,
83 -> Key.S,
84 -> Key.T,
85 -> Key.U,
86 -> Key.V,
87 -> Key.W,
88 -> Key.X,
89 -> Key.Y,
90 -> Key.Z,
48 -> Key.Digit0,
49 -> Key.Digit1,
50 -> Key.Digit2,
51 -> Key.Digit3,
52 -> Key.Digit4,
53 -> Key.Digit5,
54 -> Key.Digit6,
55 -> Key.Digit7,
56 -> Key.Digit8,
57 -> Key.Digit9,
// Letters
65 -> Key.A,
66 -> Key.B,
67 -> Key.C,
68 -> Key.D,
69 -> Key.E,
70 -> Key.F,
71 -> Key.G,
72 -> Key.H,
73 -> Key.I,
74 -> Key.J,
75 -> Key.K,
76 -> Key.L,
77 -> Key.M,
78 -> Key.N,
79 -> Key.O,
80 -> Key.P,
81 -> Key.Q,
82 -> Key.R,
83 -> Key.S,
84 -> Key.T,
85 -> Key.U,
86 -> Key.V,
87 -> Key.W,
88 -> Key.X,
89 -> Key.Y,
90 -> Key.Z,
// Numbers
48 -> Key.Digit0,
49 -> Key.Digit1,
50 -> Key.Digit2,
51 -> Key.Digit3,
52 -> Key.Digit4,
53 -> Key.Digit5,
54 -> Key.Digit6,
55 -> Key.Digit7,
56 -> Key.Digit8,
57 -> Key.Digit9,
// Numpad Numbers
96 -> Key.NumPad0,
97 -> Key.NumPad1,
98 -> Key.NumPad2,
Expand All @@ -52,18 +55,46 @@ object JsKeyMapping extends KeyMapping[Int] {
103 -> Key.NumPad7,
104 -> Key.NumPad8,
105 -> Key.NumPad9,
32 -> Key.Space,
9 -> Key.Tab,
13 -> Key.Enter,
8 -> Key.Backspace,
// Whitespace
32 -> Key.Space,
9 -> Key.Tab,
13 -> Key.Enter,
8 -> Key.Backspace,
// Control
27 -> Key.Escape,
16 -> Key.Shift,
17 -> Key.Ctrl,
18 -> Key.Alt,
224 -> Key.Meta,
38 -> Key.Up,
40 -> Key.Down,
37 -> Key.Left,
39 -> Key.Right
// Arrows
38 -> Key.Up,
40 -> Key.Down,
37 -> Key.Left,
39 -> Key.Right,
// Punctuation
190 -> Key.Period,
58 -> Key.Colon,
189 -> Key.Comma,
59 -> Key.Semicolon,
161 -> Key.ExclamationMark,
// Quotes
222 -> Key.SingleQuote,
162 -> Key.DoubleQuote,
// Slashes
191 -> Key.Slash,
220 -> Key.Backslash,
167 -> Key.Underscore,
// Math
171 -> Key.Plus,
173 -> Key.Minus,
170 -> Key.Asterisk,
61 -> Key.Equals,
// Brackets
168 -> Key.OpenParenthesis,
169 -> Key.CloseParenthesis,
// Other
166 -> Key.Ampersand,
164 -> Key.DollarSign,
64 -> Key.At
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,101 @@ import eu.joaocosta.minart.input.KeyboardInput.*
*/
object AwtKeyMapping extends KeyMapping[Int] {
protected val mappings: Map[Int, Key] = Map(
KeyEvent.VK_A -> Key.A,
KeyEvent.VK_B -> Key.B,
KeyEvent.VK_C -> Key.C,
KeyEvent.VK_D -> Key.D,
KeyEvent.VK_E -> Key.E,
KeyEvent.VK_F -> Key.F,
KeyEvent.VK_G -> Key.G,
KeyEvent.VK_H -> Key.H,
KeyEvent.VK_I -> Key.I,
KeyEvent.VK_J -> Key.J,
KeyEvent.VK_K -> Key.K,
KeyEvent.VK_L -> Key.L,
KeyEvent.VK_M -> Key.M,
KeyEvent.VK_N -> Key.N,
KeyEvent.VK_O -> Key.O,
KeyEvent.VK_P -> Key.P,
KeyEvent.VK_Q -> Key.Q,
KeyEvent.VK_R -> Key.R,
KeyEvent.VK_S -> Key.S,
KeyEvent.VK_T -> Key.T,
KeyEvent.VK_U -> Key.U,
KeyEvent.VK_V -> Key.V,
KeyEvent.VK_W -> Key.W,
KeyEvent.VK_X -> Key.X,
KeyEvent.VK_Y -> Key.Y,
KeyEvent.VK_Z -> Key.Z,
KeyEvent.VK_0 -> Key.Digit0,
KeyEvent.VK_1 -> Key.Digit1,
KeyEvent.VK_2 -> Key.Digit2,
KeyEvent.VK_3 -> Key.Digit3,
KeyEvent.VK_4 -> Key.Digit4,
KeyEvent.VK_5 -> Key.Digit5,
KeyEvent.VK_6 -> Key.Digit6,
KeyEvent.VK_7 -> Key.Digit7,
KeyEvent.VK_8 -> Key.Digit8,
KeyEvent.VK_9 -> Key.Digit9,
KeyEvent.VK_NUMPAD0 -> Key.NumPad0,
KeyEvent.VK_NUMPAD1 -> Key.NumPad1,
KeyEvent.VK_NUMPAD2 -> Key.NumPad2,
KeyEvent.VK_NUMPAD3 -> Key.NumPad3,
KeyEvent.VK_NUMPAD4 -> Key.NumPad4,
KeyEvent.VK_NUMPAD5 -> Key.NumPad5,
KeyEvent.VK_NUMPAD6 -> Key.NumPad6,
KeyEvent.VK_NUMPAD7 -> Key.NumPad7,
KeyEvent.VK_NUMPAD8 -> Key.NumPad8,
KeyEvent.VK_NUMPAD9 -> Key.NumPad9,
KeyEvent.VK_ESCAPE -> Key.Escape,
// Letters
KeyEvent.VK_A -> Key.A,
KeyEvent.VK_B -> Key.B,
KeyEvent.VK_C -> Key.C,
KeyEvent.VK_D -> Key.D,
KeyEvent.VK_E -> Key.E,
KeyEvent.VK_F -> Key.F,
KeyEvent.VK_G -> Key.G,
KeyEvent.VK_H -> Key.H,
KeyEvent.VK_I -> Key.I,
KeyEvent.VK_J -> Key.J,
KeyEvent.VK_K -> Key.K,
KeyEvent.VK_L -> Key.L,
KeyEvent.VK_M -> Key.M,
KeyEvent.VK_N -> Key.N,
KeyEvent.VK_O -> Key.O,
KeyEvent.VK_P -> Key.P,
KeyEvent.VK_Q -> Key.Q,
KeyEvent.VK_R -> Key.R,
KeyEvent.VK_S -> Key.S,
KeyEvent.VK_T -> Key.T,
KeyEvent.VK_U -> Key.U,
KeyEvent.VK_V -> Key.V,
KeyEvent.VK_W -> Key.W,
KeyEvent.VK_X -> Key.X,
KeyEvent.VK_Y -> Key.Y,
KeyEvent.VK_Z -> Key.Z,
// Numbers
KeyEvent.VK_0 -> Key.Digit0,
KeyEvent.VK_1 -> Key.Digit1,
KeyEvent.VK_2 -> Key.Digit2,
KeyEvent.VK_3 -> Key.Digit3,
KeyEvent.VK_4 -> Key.Digit4,
KeyEvent.VK_5 -> Key.Digit5,
KeyEvent.VK_6 -> Key.Digit6,
KeyEvent.VK_7 -> Key.Digit7,
KeyEvent.VK_8 -> Key.Digit8,
KeyEvent.VK_9 -> Key.Digit9,
// Numpad Numbers
KeyEvent.VK_NUMPAD0 -> Key.NumPad0,
KeyEvent.VK_NUMPAD1 -> Key.NumPad1,
KeyEvent.VK_NUMPAD2 -> Key.NumPad2,
KeyEvent.VK_NUMPAD3 -> Key.NumPad3,
KeyEvent.VK_NUMPAD4 -> Key.NumPad4,
KeyEvent.VK_NUMPAD5 -> Key.NumPad5,
KeyEvent.VK_NUMPAD6 -> Key.NumPad6,
KeyEvent.VK_NUMPAD7 -> Key.NumPad7,
KeyEvent.VK_NUMPAD8 -> Key.NumPad8,
KeyEvent.VK_NUMPAD9 -> Key.NumPad9,
// Whitespace
KeyEvent.VK_SPACE -> Key.Space,
KeyEvent.VK_TAB -> Key.Tab,
KeyEvent.VK_ENTER -> Key.Enter,
KeyEvent.VK_BACK_SPACE -> Key.Backspace,
KeyEvent.VK_SHIFT -> Key.Shift,
KeyEvent.VK_CONTROL -> Key.Ctrl,
KeyEvent.VK_ALT -> Key.Alt,
KeyEvent.VK_META -> Key.Meta,
KeyEvent.VK_WINDOWS -> Key.Meta,
KeyEvent.VK_UP -> Key.Up,
KeyEvent.VK_DOWN -> Key.Down,
KeyEvent.VK_LEFT -> Key.Left,
KeyEvent.VK_RIGHT -> Key.Right
// Control
KeyEvent.VK_ESCAPE -> Key.Escape,
KeyEvent.VK_SHIFT -> Key.Shift,
KeyEvent.VK_CONTROL -> Key.Ctrl,
KeyEvent.VK_ALT -> Key.Alt,
KeyEvent.VK_META -> Key.Meta,
KeyEvent.VK_WINDOWS -> Key.Meta,
// Arrows
KeyEvent.VK_UP -> Key.Up,
KeyEvent.VK_DOWN -> Key.Down,
KeyEvent.VK_LEFT -> Key.Left,
KeyEvent.VK_RIGHT -> Key.Right,
// Punctuation
KeyEvent.VK_PERIOD -> Key.Period,
KeyEvent.VK_DECIMAL -> Key.Period,
KeyEvent.VK_COLON -> Key.Colon,
KeyEvent.VK_COMMA -> Key.Comma,
KeyEvent.VK_SEMICOLON -> Key.Semicolon,
KeyEvent.VK_EXCLAMATION_MARK -> Key.ExclamationMark,
// Quotes
KeyEvent.VK_QUOTE -> Key.SingleQuote,
KeyEvent.VK_QUOTEDBL -> Key.DoubleQuote,
// Slashes
KeyEvent.VK_SLASH -> Key.Slash,
KeyEvent.VK_DIVIDE -> Key.Slash,
KeyEvent.VK_BACK_SLASH -> Key.Backslash,
KeyEvent.VK_UNDERSCORE -> Key.Underscore,
// Math
KeyEvent.VK_PLUS -> Key.Plus,
KeyEvent.VK_ADD -> Key.Plus,
KeyEvent.VK_MINUS -> Key.Minus,
KeyEvent.VK_SUBTRACT -> Key.Minus,
KeyEvent.VK_ASTERISK -> Key.Asterisk,
KeyEvent.VK_MULTIPLY -> Key.Asterisk,
KeyEvent.VK_EQUALS -> Key.Equals,
// Brackets
KeyEvent.VK_LEFT_PARENTHESIS -> Key.OpenParenthesis,
KeyEvent.VK_RIGHT_PARENTHESIS -> Key.CloseParenthesis,
// Other
KeyEvent.VK_AMPERSAND -> Key.Ampersand,
KeyEvent.VK_DOLLAR -> Key.DollarSign,
KeyEvent.VK_AT -> Key.At
)
}
Loading

0 comments on commit 6a577b3

Please sign in to comment.