This commit is contained in:
Xenni_cp 2009-05-11 00:49:57 +00:00
parent 58debd6827
commit cbf7aff2d8

View file

@ -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