本文整理汇总了C#中OpenTK.Input.KeyboardKeyEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# KeyboardKeyEventArgs类的具体用法?C# KeyboardKeyEventArgs怎么用?C# KeyboardKeyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyboardKeyEventArgs类属于OpenTK.Input命名空间,在下文中一共展示了KeyboardKeyEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameWindow_KeyDown
private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
{
if (Key.Escape == e.Key)
{
gameWindow.Exit();
}
}
示例2: OnKeyDown
protected void OnKeyDown(object sender, KeyboardKeyEventArgs e)
{
if(e.Key == Key.Left && camera_CAM != null) {
camera_CAM.X -= 2;
}
else if(e.Key == Key.Right && camera_CAM != null) {
camera_CAM.X += 2;
}
else if(e.Key == Key.Up && camera_CAM != null) {
camera_CAM.Y += 2;
}
else if(e.Key == Key.Down && camera_CAM != null) {
camera_CAM.Y -= 2;
}
else if(e.Key == Key.Plus && camera_CAM != null) {
camera_CAM.Z += 2;
}
else if(e.Key == Key.Minus && camera_CAM != null) {
camera_CAM.Z -= 2;
}
//Console.WriteLine(e.Key.ToString());
//Check player keyboardcontrols
//player.KeyboardControls(e);
}
示例3: KeyToChar
private char KeyToChar(KeyboardKeyEventArgs e)
{
var str = e.Key.ToString();
if (str.Length == 1) {
return e.Shift ? str[0] : str.ToLower()[0];
} else if (str.StartsWith("Number") || str.StartsWith("Keypad") && str.Length == 7) {
return str[6];
}
switch (e.Key) {
case Key.BackSlash:
return '\\';
case Key.BracketLeft:
return '(';
case Key.BracketRight:
return ')';
case Key.Comma:
return ',';
case Key.Space:
return ' ';
}
return '\0';
}
示例4: KeyDownHandler
void KeyDownHandler(object sender, KeyboardKeyEventArgs e)
{
switch (e.Key)
{
case OpenTK.Input.Key.Escape:
if (!CursorVisible)
CursorVisible = true;
else
Exit();
break;
case Key.Number1: WindowState = WindowState.Normal; break;
case Key.Number2: WindowState = WindowState.Maximized; break;
case Key.Number3: WindowState = WindowState.Fullscreen; break;
case Key.Number4: WindowState = WindowState.Minimized; break;
case Key.Number5: WindowBorder = WindowBorder.Resizable; break;
case Key.Number6: WindowBorder = WindowBorder.Fixed; break;
case Key.Number7: WindowBorder = WindowBorder.Hidden; break;
case Key.Left: X = X - 16; break;
case Key.Right: X = X + 16; break;
case Key.Up: Y = Y - 16; break;
case Key.Down: Y = Y + 16; break;
case Key.KeypadPlus:
case Key.Plus: Size += new Size(16, 16); break;
case Key.KeypadMinus:
case Key.Minus: Size -= new Size(16, 16); break;
}
}
示例5: OnKeyDown
private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
{
switch (e.Key)
{
case Key.Space: _enableMipmapping = !_enableMipmapping; break;
}
}
示例6: OnKeyDown
/// <summary>
/// Occurs whenever a keybord key is pressed.
/// </summary>
protected virtual void OnKeyDown(KeyboardKeyEventArgs e)
{
switch(e.Key)
{
// Lighting
case OpenTK.Input.Key.L:
if (GL.IsEnabled(EnableCap.Lighting)) GL.Disable(EnableCap.Lighting);
else GL.Enable(EnableCap.Lighting);
break;
// Texture
case OpenTK.Input.Key.T:
if (GL.IsEnabled(EnableCap.Texture2D)) GL.Disable(EnableCap.Texture2D);
else GL.Enable(EnableCap.Texture2D);
break;
// Dynamic Update
case OpenTK.Input.Key.D:
dynamicUpdate = !dynamicUpdate;
break;
// Exit
case OpenTK.Input.Key.Escape:
Exit();
break;
}
}
示例7: OnKeyDown
public void OnKeyDown(KeyboardKeyEventArgs e)
{
if (e.Key == Key.Enter)
{
game.States.Push(new GameState(game));
}
}
示例8: _wind_KeyDown
private void _wind_KeyDown(object sender, KeyboardKeyEventArgs e)
{
if (EventKeysDown.ContainsKey(e.Key))
{
EventKeysDown[e.Key].Invoke(null);
}
}
示例9: HandleKeyDown
// Key Down
void HandleKeyDown(object sender, KeyboardKeyEventArgs e)
{
if (e.Key == Key.Escape) windowCopy.Exit();
switch (e.Key)
{
case Key.W:
moveForward = true;
break;
case Key.A:
moveRight = true;
break;
case Key.S:
moveBack = true;
break;
case Key.D:
moveLeft = true;
break;
case Key.Q:
moveUp = true;
break;
case Key.E:
moveDown = true;
break;
}
}
示例10: OnKeyDown
private void OnKeyDown(object sender, KeyboardKeyEventArgs e)
{
// close window on escape press
if (e.Key == Key.Escape) Close();
// reset camera to default position and orientation on R press
if (e.Key == Key.R) Camera.ResetToDefault();
}
示例11: keyboard_KeyUp
void keyboard_KeyUp(object sender, KeyboardKeyEventArgs e)
{
if (root.Focused)
{
this.root.OnKeyUpEvent(new KeyEventArgs(e.Key, this.GetModifierKeys()));
}
}
示例12: game_KeyUp
static void game_KeyUp(object sender, KeyboardKeyEventArgs e)
{
while (keysDown.Contains(e.Key))
{
keysDown.Remove(e.Key);
}
}
示例13: GameWindow_KeyDown
private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
{
switch (e.Key)
{
case Key.Escape: gameWindow.Close(); break;
}
}
示例14: OnKeyUp
protected void OnKeyUp(object sender, KeyboardKeyEventArgs e)
{
base.OnKeyUp(e);
if (states.Count > 0)
states.Peek().OnKeyUp(this, e, Keyboard, Mouse);
}
示例15: Window_KeyDown
private static void Window_KeyDown(object sender, KeyboardKeyEventArgs e)
{
double coord_y = 0;
double coord_x = 0;
if (e.Key == Key.Up)
{
coord_x = 1;
coord_x *= 1;
}
if (e.Key == Key.Down)
{
coord_x = 1;
coord_x *= -1;
}
if (e.Key == Key.Right)
{
coord_y = 1;
coord_y *= 1;
}
if (e.Key == Key.Left)
{
coord_y = 1;
coord_y *= -1;
}
GL.Rotate(0.5, new Vector3d(coord_x, 0.0, 0.0));
GL.Rotate(0.5, new Vector3d(0.0, coord_y, 0.0));
}