本文整理汇总了C#中InputHelper.IsCurPress方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.IsCurPress方法的具体用法?C# InputHelper.IsCurPress怎么用?C# InputHelper.IsCurPress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputHelper
的用法示例。
在下文中一共展示了InputHelper.IsCurPress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsUpperCase
/// <summary>
/// Returns true if shift is currently being pressed.
/// </summary>
/// <param name="PressedKeys">A list of keys currently being pressed.</param>
/// <returns>True if it is being pressed, false otherwise.</returns>
private bool IsUpperCase(InputHelper Helper)
{
if (Helper.IsCurPress(Keys.LeftShift) || Helper.IsCurPress(Keys.RightShift))
return true;
return false;
}
示例2: Update
public override void Update(InputHelper Input, GameTime GTime)
{
base.Update(Input, GTime);
if (m_Mode != TextEditMode.ReadOnly)
{
m_VerticalTextBoundary = (int)(Position.X + m_Font.MeasureString(m_Lines[m_Cursor.LineIndex].SBuilder.ToString()).X);
m_IsUpperCase = IsUpperCase(Input);
if (m_HasFocus)
{
Keys[] PressedKeys = Input.CurrentKeyboardState.GetPressedKeys();
foreach (Keys K in PressedKeys)
{
if (Input.IsNewPress(K))
{
switch (K)
{
case Keys.Divide:
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '/';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("/");
m_Cursor.Position.X += m_Font.MeasureString("/").X;
m_Cursor.CharacterIndex++;
m_RemovingTxt = false;
break;
case Keys.OemSemicolon:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English":
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = ';';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append(";");
m_Cursor.CharacterIndex++;
m_MovingCursor = false;
m_RemovingTxt = false;
m_Cursor.Position.X += m_Font.MeasureString(";").X;
break;
}
}
break;
case Keys.OemQuotes:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English": //TODO: Should this be double quote if upper??
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '\'';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("'");
m_Cursor.CharacterIndex++;
m_MovingCursor = false;
m_RemovingTxt = false;
m_Cursor.Position.X += m_Font.MeasureString("'").X;
break;
}
}
break;
case Keys.OemCloseBrackets:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English":
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '}';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("}");
m_Cursor.Position.X += m_Font.MeasureString("}").X;
break;
case "Norwegian":
case "Swedish":
case "Finnish":
case "Danish":
if (IsUpperCase(Input))
{
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '^';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("^");
m_Cursor.Position.X += m_Font.MeasureString("^").X;
}
else if (Input.IsCurPress(Keys.RightAlt))
{
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '~';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("~");
//.........这里部分代码省略.........