mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-06 16:22:40 +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 mCtrlState;
|
||||||
private static bool mAltState;
|
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)
|
protected static void HandleScancode(byte aScancode, bool aReleased)
|
||||||
{
|
{
|
||||||
uint xTheScancode = aScancode;
|
uint xTheScancode = aScancode;
|
||||||
|
|
@ -130,7 +152,7 @@ namespace Cosmos.Hardware
|
||||||
{
|
{
|
||||||
aValue = (byte)(aValue ^ 0x80);
|
aValue = (byte)(aValue ^ 0x80);
|
||||||
}
|
}
|
||||||
HandleScancode(aValue, xReleased);
|
mHandleKeyboardKey(aValue, xReleased);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe void CheckInit()
|
private static unsafe void CheckInit()
|
||||||
|
|
@ -296,7 +318,7 @@ namespace Cosmos.Hardware
|
||||||
mKeys = aKeys;
|
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++)
|
for (int i = 0; i < mKeys.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -322,6 +344,23 @@ namespace Cosmos.Hardware
|
||||||
}
|
}
|
||||||
return xResult;
|
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>
|
/// <summary>
|
||||||
/// Represents the current KeyMap
|
/// Represents the current KeyMap
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue