forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIG keyboard work (not finished though)
- Loading branch information
1 parent
9c90d10
commit 58646d1
Showing
10 changed files
with
598 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
namespace Cosmos.HAL | ||
{ | ||
public enum ConsoleKeyEx | ||
{ | ||
NoName, | ||
|
||
Escape, | ||
|
||
F1, | ||
F2, | ||
F3, | ||
F4, | ||
F5, | ||
F6, | ||
F7, | ||
F8, | ||
F9, | ||
F10, | ||
F11, | ||
F12, | ||
|
||
PrintScreen, | ||
ScrollLock, | ||
PauseBreak, | ||
|
||
Backquote, | ||
D1, | ||
D2, | ||
D3, | ||
D4, | ||
D5, | ||
D6, | ||
D7, | ||
D8, | ||
D9, | ||
D0, | ||
Minus, | ||
Equal, | ||
Backslash, | ||
Backspace, | ||
|
||
Tab, | ||
Q, | ||
W, | ||
E, | ||
R, | ||
T, | ||
Y, | ||
U, | ||
I, | ||
O, | ||
P, | ||
LBracket, | ||
RBracket, | ||
Enter, | ||
|
||
CapsLock, | ||
A, | ||
S, | ||
D, | ||
F, | ||
G, | ||
H, | ||
J, | ||
K, | ||
L, | ||
Semicolon, | ||
Apostrophe, | ||
|
||
Shift, | ||
Z, | ||
X, | ||
C, | ||
V, | ||
B, | ||
N, | ||
M, | ||
Comma, | ||
Period, | ||
Slash, | ||
|
||
Ctrl, | ||
LWin, | ||
Alt, | ||
Spacebar, | ||
AltGr, | ||
RWin, | ||
Menu, | ||
|
||
Insert, | ||
Home, | ||
PageUp, | ||
Delete, | ||
End, | ||
PageDown, | ||
|
||
UpArrow, | ||
DownArrow, | ||
LeftArrow, | ||
RightArrow, | ||
|
||
NumLock, | ||
NumDivide, | ||
NumMultiply, | ||
NumMinus, | ||
Num7, | ||
Num8, | ||
Num9, | ||
NumPlus, | ||
Num4, | ||
Num5, | ||
Num6, | ||
Num1, | ||
Num2, | ||
Num3, | ||
Num0, | ||
NumPeriod, | ||
NumEnter, | ||
|
||
Power, | ||
Sleep, | ||
Wake | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
|
||
namespace Cosmos.HAL | ||
{ | ||
public class KeyEvent | ||
{ | ||
public enum KeyEventType | ||
{ | ||
Make, | ||
Break | ||
} | ||
|
||
// todo: once Github issue #137 is fixed, replace this class with ConsoleKeyInfo struct. | ||
// Well, this one has more features | ||
|
||
public char KeyChar | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public ConsoleKeyEx Key | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public ConsoleModifiers Modifiers | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public KeyEventType Type { get; set; } | ||
|
||
public KeyEvent() | ||
{ | ||
KeyChar = '\0'; | ||
Key = ConsoleKeyEx.NoName; | ||
this.Modifiers = (ConsoleModifiers)0; | ||
Type = KeyEventType.Make; | ||
} | ||
|
||
public KeyEvent(char keyChar, ConsoleKeyEx key, bool shift, bool alt, bool control, KeyEventType type) | ||
{ | ||
this.KeyChar = keyChar; | ||
this.Key = key; | ||
this.Modifiers = (ConsoleModifiers)0; | ||
if (shift) | ||
{ | ||
this.Modifiers |= ConsoleModifiers.Shift; | ||
} | ||
if (alt) | ||
{ | ||
this.Modifiers |= ConsoleModifiers.Alt; | ||
} | ||
if (control) | ||
{ | ||
this.Modifiers |= ConsoleModifiers.Control; | ||
} | ||
this.Type = type; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
namespace Cosmos.HAL | ||
{ | ||
public class KeyMapping | ||
{ | ||
public uint Scancode; | ||
public char Value; | ||
public char Shift; | ||
public char Ctrl; | ||
public char Alt; | ||
public char Num; | ||
public char Caps; | ||
public char ShiftCaps; | ||
public char ShiftNum; | ||
public ConsoleKeyEx Key; | ||
public ConsoleKeyEx NumLockKey; | ||
|
||
public KeyMapping(uint aScanCode, char norm, char shift, char ctrl, char alt, char num, char caps, char shiftcaps, char shiftnum, ConsoleKeyEx aKey) | ||
{ | ||
Scancode = aScanCode; | ||
Value = norm; | ||
Shift = shift; | ||
Ctrl = ctrl; | ||
Alt = alt; | ||
Num = num; | ||
Caps = caps; | ||
ShiftCaps = shiftcaps; | ||
ShiftNum = shiftnum; | ||
Key = aKey; | ||
NumLockKey = aKey; | ||
} | ||
|
||
public KeyMapping(uint aScanCode, char norm, char shift, char ctrl, char alt, char num, char caps, char shiftcaps, char shiftnum, ConsoleKeyEx aKey, ConsoleKeyEx numKey) | ||
: this(aScanCode, norm, shift, ctrl, alt, num, caps, shiftcaps, shiftnum, aKey) | ||
{ | ||
NumLockKey = numKey; | ||
} | ||
|
||
public KeyMapping(uint aScanCode, char num, ConsoleKeyEx aKey, ConsoleKeyEx numKey) | ||
: this(aScanCode, '\0', '\0', '\0', '\0', num, '\0', '\0', '\0', aKey, numKey) | ||
{ | ||
} | ||
|
||
public KeyMapping(uint aScanCode, int norm, int shift, int ctrl, int alt, int num, int caps, int shiftcaps, int shiftnum, ConsoleKeyEx aKey) | ||
: this(aScanCode, (char)norm, (char)shift, (char)ctrl, (char)alt, (char)num, (char)caps, (char)shiftcaps, (char)shiftnum, aKey) | ||
{ | ||
} | ||
|
||
public KeyMapping(uint aScanCode, char n, ConsoleKeyEx aKey) | ||
: this(aScanCode, n, n, n, n, n, n, n, n, aKey) | ||
{ | ||
} | ||
|
||
public KeyMapping(uint aScanCode, ConsoleKeyEx aKey) | ||
: this(aScanCode, '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', aKey) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.