mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 22:09:12 +00:00
This commit is contained in:
parent
58debd6827
commit
cbf7aff2d8
1 changed files with 41 additions and 2 deletions
|
|
@ -62,6 +62,28 @@ namespace Cosmos.Hardware
|
|||
private static bool mCtrlState;
|
||||
private static bool mAltState;
|
||||
|
||||
public static bool ShiftPressed
|
||||
{
|
||||
get
|
||||
{
|
||||
return mShiftState;
|
||||
}
|
||||
}
|
||||
public static bool CtrlPressed
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCtrlState;
|
||||
}
|
||||
}
|
||||
public static bool AltPressed
|
||||
{
|
||||
get
|
||||
{
|
||||
return mAltState;
|
||||
}
|
||||
}
|
||||
|
||||
protected static void HandleScancode(byte aScancode, bool aReleased)
|
||||
{
|
||||
uint xTheScancode = aScancode;
|
||||
|
|
@ -130,7 +152,7 @@ namespace Cosmos.Hardware
|
|||
{
|
||||
aValue = (byte)(aValue ^ 0x80);
|
||||
}
|
||||
HandleScancode(aValue, xReleased);
|
||||
mHandleKeyboardKey(aValue, xReleased);
|
||||
}
|
||||
|
||||
private static unsafe void CheckInit()
|
||||
|
|
@ -296,7 +318,7 @@ namespace Cosmos.Hardware
|
|||
mKeys = aKeys;
|
||||
}
|
||||
|
||||
private static bool GetCharValue(uint aScanCode, out char aValue)
|
||||
public static bool GetCharValue(uint aScanCode, out char aValue)
|
||||
{
|
||||
for (int i = 0; i < mKeys.Count; i++)
|
||||
{
|
||||
|
|
@ -322,6 +344,23 @@ namespace Cosmos.Hardware
|
|||
}
|
||||
return xResult;
|
||||
}
|
||||
public static bool GetChar(out char c)
|
||||
{
|
||||
CheckInit();
|
||||
|
||||
c = '\0';
|
||||
|
||||
if (mBuffer.Count > 0)
|
||||
{
|
||||
GetCharValue(mBuffer.Dequeue(), out c);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the current KeyMap
|
||||
|
|
|
|||
Loading…
Reference in a new issue