Do not cache instances of this type outside their event handler. If necessary, you can clone a KeyboardEventArgs instance using the KeyboardKeyEventArgs(KeyboardKeyEventArgs) constructor.
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); }
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)); }
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(); }
static void game_KeyUp(object sender, KeyboardKeyEventArgs e) { while (keysDown.Contains(e.Key)) { keysDown.Remove(e.Key); } }
void keyboard_KeyUp(object sender, KeyboardKeyEventArgs e) { if (root.Focused) { this.root.OnKeyUpEvent(new KeyEventArgs(e.Key, this.GetModifierKeys())); } }
private void _wind_KeyDown(object sender, KeyboardKeyEventArgs e) { if (EventKeysDown.ContainsKey(e.Key)) { EventKeysDown[e.Key].Invoke(null); } }
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; } }
// 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; } }
private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e) { switch (e.Key) { case Key.Escape: gameWindow.Close(); break; } }
private void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e) { if (Key.Escape == e.Key) { gameWindow.Exit(); } }
/// <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; } }
public void OnKeyDown(KeyboardKeyEventArgs e) { if (e.Key == Key.Enter) { game.States.Push(new GameState(game)); } }
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'; }
protected void OnKeyUp(object sender, KeyboardKeyEventArgs e) { base.OnKeyUp(e); if (states.Count > 0) states.Peek().OnKeyUp(this, e, Keyboard, Mouse); }
private void OnKeyDown(object sender, KeyboardKeyEventArgs e) { switch (e.Key) { case Key.Space: _enableMipmapping = !_enableMipmapping; break; } }
private void Game_KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { game.Exit(); this.Close(); } }
private void gameWindow_KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.NumLock) numLock = !numLock; else if (e.Key == Key.CapsLock) capsLock = !capsLock; else if (e.Key == Key.ScrollLock) scrollLock = !scrollLock; KeyPress newKeyPress = new KeyPress(e.Key, e.Alt, e.Shift, e.Control, e.IsRepeat, numLock, capsLock, scrollLock); if (keyPress != newKeyPress) keyPress = newKeyPress; }
void Event_KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) this.Exit(); if (e.Key == Key.F11) this.WindowState = (this.WindowState == WindowState.Normal) ? WindowState.Fullscreen : WindowState.Normal; }
protected override void OnKeyUp(KeyboardKeyEventArgs e) { base.OnKeyUp(e); inputState.RemoveKey(e.Key); //updates current game state input if (stateManager != null) stateManager.Top.ProcessInput(inputState); }
private void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Enter) { Scene.Current.Dispose(); Scene.Current = GameRes.Data.Scenes.GameScene_Scene.Res; } else if (e.Key == Key.Escape) DualityApp.Terminate(); }
protected void laserKeyDownHandler(object sender, KeyboardKeyEventArgs e) { if (!base.Focused) return; if (e.Key == Key.Q) { if (activeLaser.Target == null) { _createLaser (); } } }
protected override void OnKeyDown(KeyboardKeyEventArgs e) { base.OnKeyDown(e); var state = OpenTK.Input.Keyboard.GetState(); if (state[Key.Escape]) { Exit(); } }
void KeyDown( object sender, KeyboardKeyEventArgs e ) { if( e.Key == Key.Tab ) { HandleTab(); } else if( e.Key == Key.Enter ) { LauncherWidget widget = selectedWidget; if( widget != null && widget.OnClick != null ) widget.OnClick( 0, 0 ); } }
public static void KeyUp(KeyboardKeyEventArgs e) { if (Focused) { HandleKeyUp(e.Key); var remappedKey = RemapKey(e.Key); if (remappedKey != e.Key) HandleKeyUp(remappedKey); } }
private void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) { bool isShift = PoincareWindow.Keyboard[Key.LShift] || PoincareWindow.Keyboard[Key.RShift]; switch (e.Key) { case Key.P: PoincareWindow.P += isShift ? -1 : 1; PoincareWindow.Reset(); break; case Key.Q: PoincareWindow.Q += isShift ? -1 : 1; PoincareWindow.Reset(); break; case Key.N: PoincareWindow.ImageIndex = (PoincareWindow.ImageIndex + (isShift ? PoincareWindow.ImageFiles.Count - 1 : 1)) % PoincareWindow.ImageFiles.Count; PoincareWindow.Reset(); break; case Key.Z: PoincareWindow.Randomize(); break; case Key.R: PoincareWindow.Offset = Complex.Zero; PoincareWindow.AngleOffset = 0; PoincareWindow.Reset(); break; case Key.L: PoincareWindow.MakeLimitRotation(); break; case Key.I: PoincareWindow.IsInverting = !PoincareWindow.IsInverting; PoincareWindow.Reset(); break; case Key.M: PoincareWindow.IsMoving = !PoincareWindow.IsMoving; break; case Key.F: PoincareWindow.ToggleFullscreen(); break; case Key.Escape: PoincareWindow.Exit(); break; case Key.Tab: break; } }
private static void HandleKeydown(Object sender, KeyboardKeyEventArgs ea) { switch (ea.Key) { case Key.Escape: _win.Close(); break; default: break; } }
void keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) { if (root.Focused) { this.root.OnKeyDownEvent(new KeyEventArgs(e.Key, this.GetModifierKeys())); if(!root.Focused) { this.root.Focused = true; } } }
private void keyUpHandler1(object sender, KeyboardKeyEventArgs e) { if (!base.Focused) return; switch (e.Key) { case Key.Q: renderMesh4AttackSm.requestTransition ("attack"); renderMesh5AttackSm.requestTransition ("attack"); break; } }
/// <summary> /// Occurs when a key is pressed. /// </summary> /// <param name="sender">The KeyboardDevice which generated this event.</param> /// <param name="key">The key that was pressed.</param> void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) this.Exit(); if (e.Key == Key.F11) if (this.WindowState == WindowState.Fullscreen) this.WindowState = WindowState.Normal; else this.WindowState = WindowState.Fullscreen; }
/// <summary> /// Occurs when a key is pressed. /// </summary> /// <param name="sender">The KeyboardDevice which generated this event.</param> /// <param name="e">The key that was pressed.</param> static void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) { if(e.Key == global::OpenTK.Input.Key.AltLeft) altDown = true; else if(altDown && e.Key == global::OpenTK.Input.Key.Enter) { if(GraphicsManager.windowstate == WindowState.Fullscreen) GraphicsManager.windowstate = WindowState.Normal; else GraphicsManager.windowstate = WindowState.Fullscreen; } input.ProcessKeyDown(e); }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { Exit(); } else { if (e.Key == Key.Space) { if (contPrimitiva < lprimi.Count - 1) { contPrimitiva++; } else { contPrimitiva = 0; } } } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { this.Exit(); } else if (e.Key == Key.F) { GL.CullFace(CullFaceMode.Front); } if (e.Key == Key.B) { GL.CullFace(CullFaceMode.Back); } if (e.Key == Key.A) { //FIXME: aqui deveria aplicar a textura no lado de fora e dentro, mas não aparece nada GL.CullFace(CullFaceMode.FrontAndBack); } }
public override void KeyDown(OpenTK.Input.KeyboardKeyEventArgs e, WidgetController.ModifierKeys k) { if (Status != WidgetStatus.Disabled) { if (e.Key == _keyLeft) { SelectedIndex = Math.Max(SelectedIndex - _rows, 0); } if (e.Key == _keyRight) { SelectedIndex = Math.Min(SelectedIndex + _rows, _items.Count - 1); } if (e.Key == _keyUp) { SelectedIndex = Math.Max(SelectedIndex - 1, 0); } if (e.Key == _keyDown) { SelectedIndex = Math.Min(SelectedIndex + 1, _items.Count - 1);; } } }
void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { // v0.3 switch (e.Key) { case Key.F: this.WindowState = (this.WindowState == WindowState.Fullscreen) ? WindowState.Normal : OpenTK.WindowState.Fullscreen; break; case Key.V: this.VSync = (this.VSync == VSyncMode.On) ? VSyncMode.Off : VSyncMode.On; break; case Key.Escape: this.Exit(); break; case Key.Tilde: fps = !fps; break; } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.E) { for (var i = 0; i < objetosLista.Count; i++) { objetosLista[i].PontosExibirObjeto(); } } else if (e.Key == Key.M) { moverPto = !moverPto; if (moverPto == false) { circuloMenor.Restaurar(); } } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.E) // Esquerda { camera.goEsquerda(); } else if (e.Key == Key.D) // Direita { camera.goDireita(); } else if (e.Key == Key.C) //Cima { camera.goCima(); } else if (e.Key == Key.B) //Baixo { camera.goBaixo(); } else if (e.Key == Key.I) //Zoom in { camera.goZoomIn(); } else if (e.Key == Key.O) //Zoom Out { camera.goZoomOut(); } else { Console.WriteLine(" __ Tecla não implementada."); } }
public static bool ProcessInputKey(this IGuiMenuItem item, OpenTK.Input.KeyboardKeyEventArgs e) { if (!(item.Visible && item.Enabled)) { return(false); } if (item.ModifierKey == e.Modifiers && item.HotKey == e.Key) { if (item.OnClick()) { return(true); } } // recurse through all children foreach (var child in item.Children) { if (child.ProcessInputKey(e)) { return(true); } } return(false); }
private void Window_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { switch(e.Key) { case Key.Left: InputReceived?.Invoke(InputType.LEFT); break; case Key.Right: InputReceived?.Invoke(InputType.RIGHT); break; case Key.Escape: InputReceived?.Invoke(InputType.EXIT); break; case Key.Enter: InputReceived?.Invoke(InputType.SELECT); break; case Key.BackSpace: InputReceived?.Invoke(InputType.BACK); break; default: break; } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.D) { comDisplayList = !comDisplayList; } else if (e.Key == Key.Minus && clones > 1) { clones -= 1; } else if (e.Key == Key.Plus) { clones += 1; } if (comDisplayList) { Console.WriteLine("COM display: " + clones); } else { Console.WriteLine("SEM display: " + clones); } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.W) { Console.WriteLine("--- Objetos / Pontos: "); for (var i = 0; i < objetosLista.Count; i++) { Console.WriteLine(objetosLista[i]); } } else { Console.WriteLine(" __ Tecla não implementada."); } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { this.Exit(); } if (e.Key == Key.T) { seguirTerra = true; projecaoTerra(); CameraTerra(); } if (e.Key == Key.N) { seguirTerra = false; CameraReprojetaTela(); OrigemCamera(); } if (e.Key == Key.P) { stop = true; } if (e.Key == Key.C) { stop = false; } // else // if (e.Key == Key.F) // GL.CullFace(CullFaceMode.Front); // if (e.Key == Key.B) // GL.CullFace(CullFaceMode.Back); // if (e.Key == Key.A) // //FIXME: aqui deveria aplicar a textura no lado de fora e dentro, mas não aparece nada // GL.CullFace(CullFaceMode.FrontAndBack); }
private void MouseKeyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == OpenTK.Input.Key.Number5) { if (_workMode) { _workMode = false; OnWorkModeChanged(new WorkModeEventArgs(WorkModeState.Disabled)); } else { _workMode = true; OnWorkModeChanged(new WorkModeEventArgs(WorkModeState.Enabled)); } } if (e.Key == OpenTK.Input.Key.Number1) { OnPrevPartChoosed(new EventArgs()); } if (e.Key == OpenTK.Input.Key.Number2) { OnNextPartChoosed(new EventArgs()); } if (e.Key == OpenTK.Input.Key.Number3) { OnPartDispModeChanged(new EventArgs()); } if (e.Key == OpenTK.Input.Key.Number4) { OnAllPartDispModeChanged(new EventArgs()); } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.E) { Console.WriteLine("--- Objetos / Pontos: "); for (var i = 0; i < objetosLista.Count; i++) { Console.WriteLine(objetosLista[i]); } } else if (e.Key == Key.O) { bBoxDesenhar = !bBoxDesenhar; } else if (e.Key == Key.Enter) { if (objetoNovo != null) { objetoNovo.PontosRemoverUltimo(); // N3-Exe6: "truque" para deixar o rastro objetoSelecionado = objetoNovo; objetoNovo = null; } } else if (e.Key == Key.Space) { if (objetoNovo == null) { objetoNovo = new Poligono(objetoId + 1, null); objetosLista.Add(objetoNovo); objetoNovo.PontosAdicionar(new Ponto4D(mouseX, mouseY)); objetoNovo.PontosAdicionar(new Ponto4D(mouseX, mouseY)); // N3-Exe6: "troque" para deixar o rastro } else { objetoNovo.PontosAdicionar(new Ponto4D(mouseX, mouseY)); } } else if (objetoSelecionado != null) { if (e.Key == Key.M) { Console.WriteLine(objetoSelecionado.Matriz); } else if (e.Key == Key.P) { Console.WriteLine(objetoSelecionado); } else if (e.Key == Key.I) { objetoSelecionado.AtribuirIdentidade(); } //TODO: não está atualizando a BBox com as transformações geométricas else if (e.Key == Key.Left) { objetoSelecionado.TranslacaoXYZ(-10, 0, 0); } else if (e.Key == Key.Right) { objetoSelecionado.TranslacaoXYZ(10, 0, 0); } else if (e.Key == Key.Up) { objetoSelecionado.TranslacaoXYZ(0, 10, 0); } else if (e.Key == Key.Down) { objetoSelecionado.TranslacaoXYZ(0, -10, 0); } else if (e.Key == Key.PageUp) { objetoSelecionado.EscalaXYZ(2, 2, 2); } else if (e.Key == Key.PageDown) { objetoSelecionado.EscalaXYZ(0.5, 0.5, 0.5); } else if (e.Key == Key.Home) { objetoSelecionado.EscalaXYZBBox(0.5, 0.5, 0.5); } else if (e.Key == Key.End) { objetoSelecionado.EscalaXYZBBox(2, 2, 2); } else if (e.Key == Key.Number1) { objetoSelecionado.Rotacao(10); } else if (e.Key == Key.Number2) { objetoSelecionado.Rotacao(-10); } else if (e.Key == Key.Number3) { objetoSelecionado.RotacaoZBBox(10); } else if (e.Key == Key.Number4) { objetoSelecionado.RotacaoZBBox(-10); } else if (e.Key == Key.Number9) { objetoSelecionado = null; // desmacar objeto selecionado } else { Console.WriteLine(" __ Tecla não implementada."); } } else { Console.WriteLine(" __ Tecla não implementada."); } }
public void KeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { //cam.keyDown(e); int index = -1; if (e.Key == OpenTK.Input.Key.Number1) { index = 0; } if (e.Key == OpenTK.Input.Key.Number2) { index = 1; } if (e.Key == OpenTK.Input.Key.Number3) { index = 2; } if (e.Key == OpenTK.Input.Key.Number4) { index = 3; } if (e.Key == OpenTK.Input.Key.Number5) { index = 4; } if (e.Key == OpenTK.Input.Key.Number6) { index = 5; } if (e.Key == OpenTK.Input.Key.Number7) { index = 6; } if (e.Key == OpenTK.Input.Key.Number8) { index = 7; } if (e.Key == OpenTK.Input.Key.Number9) { index = 8; } if (e.Key == OpenTK.Input.Key.Number0) { index = 9; } if (index != -1) { if (index == 9) { cam.SetFocus(sun); } else { cam.SetFocus(planets[index]); } } if (e.Key == Key.R) { var result = contentManager.ReloadShader("earth"); System.Console.WriteLine(result); //contentManager.ReloadShader("final"); result = contentManager.ReloadShader("sunShader"); System.Console.WriteLine(result); } if (e.Key == Key.C) { System.Console.WriteLine(lineShader.Reload()); } //if (e.KeyCode == Keys.S) // cam.setFocus(sun); }
private void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs kbe) { pressedKey.Remove(kbe.Key); }
void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { Key.Event(MapKey(e.Key), true); }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (PontoSelecionado == null) { PontoSelecionado = A; } if (e.Key == Key.Escape) { Exit(); } //Reinicia if (e.Key == Key.R) { SetaValoresIniciais(); } //Aumenta a quantidade de ponto da Spline if (e.Key == Key.Plus || e.Key == Key.KeypadPlus) { qtdPontos++; } //Diminui a quantidade de ponto da Spline if (e.Key == Key.Minus || e.Key == Key.KeypadMinus) { if (qtdPontos > 0) { qtdPontos--; } } //Muda pontos if (e.Key == Key.Number1 || e.Key == Key.Keypad1) { PontoSelecionado = A; ponto = pontos.A; } if (e.Key == Key.Number2 || e.Key == Key.Keypad2) { PontoSelecionado = B; ponto = pontos.B; } if (e.Key == Key.Number3 || e.Key == Key.Keypad3) { PontoSelecionado = C; ponto = pontos.C; } if (e.Key == Key.Number4 || e.Key == Key.Keypad4) { PontoSelecionado = D; ponto = pontos.D; } //Cima if (e.Key == Key.C) { PontoSelecionado.Y++; } //Baixo if (e.Key == Key.B) { PontoSelecionado.Y--; } //Direita if (e.Key == Key.D) { PontoSelecionado.X++; } //Esquerda if (e.Key == Key.E) { PontoSelecionado.X--; } }
private void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs kbe) { pressedKey.Add(kbe.Key); }
void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { Key.Event(MapKey(e.Key), false); }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.Escape) { Exit(); } else //Desloca pra esquerda if (e.Key == Key.E) { camera.xmin -= 10; camera.xmax -= 10; } else //Desloca pra direita if (e.Key == Key.D) { camera.xmin += 10; camera.xmax += 10; } else //Desloca pra cima if (e.Key == Key.C) { camera.ymin += 10; camera.ymax += 10; } else //Desloca pra baixo if (e.Key == Key.B) { camera.ymin -= 10; camera.ymax -= 10; } else //Aproximar if (e.Key == Key.I) { //controle para não inverter o cara com zoom máximo if (camera.xmax >= 1 && camera.ymax >= 1) { camera.xmin += 10; camera.xmax -= 10; camera.ymin += 10; camera.ymax -= 10; } } else //Afastar if (e.Key == Key.O) { //controle para não ferrar o cara com zoom mínimo if (camera.xmax <= 300 && camera.ymax <= 300) { camera.xmin -= 10; camera.xmax += 10; camera.ymin -= 10; camera.ymax += 10; } } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.T) { Console.WriteLine("--- Objetos / Pontos: "); for (var i = 0; i < objetosLista.Count; i++) { Console.WriteLine(objetosLista[i]); } } else if (e.Key == Key.U) { bBoxDesenhar = !bBoxDesenhar; } else if (e.Key == Key.V) { mouseMoverPto = !mouseMoverPto; //TODO: falta atualizar a BBox do objeto } else if (e.Key == Key.E) { this.spline.goEsquerda(); } else if (e.Key == Key.D) { this.spline.goDireita(); } else if (e.Key == Key.C) { this.spline.goCima(); } else if (e.Key == Key.B) { this.spline.goBaixo(); } else if (e.Key == Key.KeypadPlus) { this.spline.addPontos(); } else if (e.Key == Key.KeypadMinus) { this.spline.subPontos(); } else if (e.Key == Key.Keypad1) { this.spline.changePonto(0); } else if (e.Key == Key.Keypad2) { this.spline.changePonto(1); } else if (e.Key == Key.Keypad3) { this.spline.changePonto(2); } else if (e.Key == Key.Keypad4) { this.spline.changePonto(3); } else { Console.WriteLine(" __ Tecla não implementada."); } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.Escape) { Exit(); } else if (e.Key == Key.W) { Console.WriteLine("--- Objetos / Pontos: "); for (var i = 0; i < objetosLista.Count; i++) { Console.WriteLine(objetosLista[i]); } } else if (e.Key == Key.Space) // Alterar { this.keyControll++; if (this.keyControll == 1) { this.beginMode = BeginMode.Lines; } else if (this.keyControll == 2) { this.beginMode = BeginMode.LineLoop; } else if (this.keyControll == 3) { this.beginMode = BeginMode.LineStrip; } else if (this.keyControll == 4) { this.beginMode = BeginMode.Triangles; } else if (this.keyControll == 5) { this.beginMode = BeginMode.Triangles; } else if (this.keyControll == 6) { this.beginMode = BeginMode.Quads; } else if (this.keyControll == 7) { this.beginMode = BeginMode.TriangleFan; } else if (this.keyControll == 8) { this.beginMode = BeginMode.QuadStrip; } else if (this.keyControll == 9) { this.beginMode = BeginMode.Quads; } else { this.keyControll = 0; this.beginMode = BeginMode.Points; } } else { Console.WriteLine(" __ Tecla não implementada."); } }
public KeyUpEvent(OpenTK.Input.KeyboardKeyEventArgs EventArgs) { this.EventArgs = EventArgs; }
private void OpenTKKeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { OnKeyDown(OpenTKToOpenGlobe(e.Key)); }
/// <summary> /// Constructs a new KeyboardEventArgs instance. /// </summary> /// <param name="args">An existing KeyboardEventArgs instance to clone.</param> public KeyboardKeyEventArgs(KeyboardKeyEventArgs args) { Key = args.Key; ScanCode = args.ScanCode; }
private void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { switch (e.Key) { case Key.F12: // toggle graph debugger showGraphDebugger = !showGraphDebugger; if (showGraphDebugger) { X3DGraphDebugger.Display(scene.SceneGraph); } else { X3DGraphDebugger.Hide(); } break; case Key.F1: // toggle wireframe wireframe = !wireframe; if (wireframe) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } else { if (points_only) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Point); } else { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } } break; case Key.F2: // toggle points points_only = !points_only; if (points_only) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Point); } else { if (wireframe) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } else { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } } break; case Key.F3: // halt special effects fx_enable = !fx_enable; break; case Key.F4: // halt rotate rotate_enable = !rotate_enable; break; case Key.F5: // reload current scene Reload(); break; case Key.F: if (window.WindowState == OpenTK.WindowState.Normal) { window.WindowState = WindowState.Fullscreen; lockMouseCursor = true; } else { window.WindowState = WindowState.Normal; lockMouseCursor = false; } isFullscreen = !isFullscreen; ToggleCursor(); break; case Key.O: NavigationInfo.HeadlightEnabled = !NavigationInfo.HeadlightEnabled; break; case Key.V: // View all viewpoints string text = ""; foreach (Viewpoint v in Viewpoint.ViewpointList) { text += "[" + v.description + "] "; } // Integrate this into HUD System.Windows.Forms.MessageBox.Show("Viewpoints: " + text.TrimEnd()); break; #region Viewpoint Key Bindings case Key.Home: // Goto Initial Viewpoint Viewpoint.CurrentIndex = (Viewpoint.InitialViewpoint == null ? -1 : 0); Viewpoint.CurrentViewpoint = Viewpoint.InitialViewpoint; break; case Key.PageDown: // Goto Next Viewpoint if (Viewpoint.ViewpointList.Count > 0) { if (Viewpoint.CurrentIndex + 1 == Viewpoint.ViewpointList.Count) { Viewpoint.CurrentIndex = 0; } else { Viewpoint.CurrentIndex++; } Viewpoint.CurrentViewpoint = Viewpoint.ViewpointList[Viewpoint.CurrentIndex]; } break; case Key.PageUp: // Goto Previous viewpoint if (Viewpoint.ViewpointList.Count > 0) { if (Viewpoint.CurrentIndex - 1 < 0) { Viewpoint.CurrentIndex = Viewpoint.ViewpointList.Count - 1; } else { Viewpoint.CurrentIndex--; } Viewpoint.CurrentViewpoint = Viewpoint.ViewpointList[Viewpoint.CurrentIndex]; } break; case Key.End: // Goto Final Viewpoint Viewpoint.CurrentIndex = Viewpoint.ViewpointList.Count - 1; Viewpoint.CurrentViewpoint = Viewpoint.FinalViewpoint; break; #endregion } }
public void Event_KeyRelease(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { //keyStates.Add(e.Key, false); keyStates[e.Key] = false; }
public static void Keyboard_KeyDown(ref ICubeMap cubeMap, ICamera camera, ILight light, ITerrain terrain, ref Vector3 initCameraPosition, ref float cameraAngle, float farDist, OpenTK.Input.KeyboardKeyEventArgs e) { switch (e.Key) { case Key.Up: initCameraPosition = CameraFoward(camera, initCameraPosition, cameraAngle, farDist); break; case Key.Down: initCameraPosition = CameraBackward(camera, initCameraPosition, cameraAngle, farDist); break; case Key.Right: cameraAngle = CameraRight(camera, cameraAngle, farDist); break; case Key.Left: cameraAngle = CameraLeft(camera, cameraAngle, farDist); break; case Key.A: initCameraPosition = CameraUp(camera, initCameraPosition, cameraAngle, farDist); break; case Key.Z: initCameraPosition = CameraDown(camera, initCameraPosition, cameraAngle, farDist); break; case Key.W: GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); break; case Key.S: GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); break; case Key.M: UIInputData.IsMapOn = true; break; case Key.Escape: UIInputData.IsMapOn = false; break; case Key.T: UIInputData.IsTerrainOn = true; UIInputData.IsOceanOn = false; break; case Key.O: UIInputData.IsTerrainOn = false; UIInputData.IsOceanOn = true; break; case Key.R: UIInputData.FresnelParameter += 0.1f; break; case Key.F: UIInputData.FresnelParameter -= 0.1f; break; case Key.C: if (UIInputData.IsWoodenChestOn) { UIInputData.IsWoodenChestOn = false; } else { UIInputData.IsWoodenChestOn = true; } break; case Key.F1: UIInputData.IsWaterCalm = false; break; case Key.F2: UIInputData.IsWaterCalm = true; break; case Key.F12: UIInputData.StormParameter = new float[] { 2, 1.5f, 1.5f, 4, 2 }; break; case Key.F11: UIInputData.StormParameter = new float[] { 1, 1, 1, 1, 1 }; break; case Key.D: if (UIInputData.isDiffuseOn) { UIInputData.isDiffuseOn = false; } else { UIInputData.isDiffuseOn = true; } break; case Key.F3: Vector3 pos = light.LightPosition; light.LightPosition = new Vector3(pos.X + 1.0f, light.LightPosition.Y, light.LightPosition.Z); break; case Key.F4: pos = light.LightPosition; light.LightPosition = new Vector3(pos.X - 1.0f, light.LightPosition.Y, light.LightPosition.Z); break; case Key.F5: pos = light.LightPosition; light.LightPosition = new Vector3(pos.X, light.LightPosition.Y + 1.0f, light.LightPosition.Z); break; case Key.F6: pos = light.LightPosition; light.LightPosition = new Vector3(pos.X, light.LightPosition.Y - 1.0f, light.LightPosition.Z); break; case Key.F7: pos = light.LightPosition; light.LightPosition = new Vector3(pos.X, light.LightPosition.Y, light.LightPosition.Z + 1.0f); break; case Key.F8: pos = light.LightPosition; light.LightPosition = new Vector3(pos.X, light.LightPosition.Y, light.LightPosition.Z - 1.0f); break; case Key.Number1: ChangeCubeMap(ref cubeMap, "Mountain"); break; case Key.Number2: ChangeCubeMap(ref cubeMap, "Desert"); break; case Key.Number3: ChangeCubeMap(ref cubeMap, "Frozen"); break; case Key.Number4: ChangeCubeMap(ref cubeMap, "Spooky"); break; case Key.Number5: terrain.Load(true); break; case Key.Number6: terrain.Load(true, true); break; } }
protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e) { // Console.Clear(); //TODO: não funciona. if (e.Key == Key.H) { Utilitario.AjudaTeclado(); } else if (e.Key == Key.F1) { Utilitario.AjudaJogo(); } else if (e.Key == Key.Escape) { Exit(); } //-------------------------------------------------------------- else if (e.Key == Key.Number9) { objetoSelecionado = null; // desmacar objeto selecionado } else if (e.Key == Key.B) { bBoxDesenhar = !bBoxDesenhar; //FIXME: bBox não está sendo atualizada. } else if (e.Key == Key.Enter) { obj_Tabuleiro.enter(); } else if (e.Key == Key.E) { Console.WriteLine("--- Objetos / Pontos: "); for (var i = 0; i < objetosLista.Count; i++) { Console.WriteLine(objetosLista[i]); } } //-------------------------------------------------------------- else if (e.Key == Key.X) { menuEixoSelecao = 'x'; } else if (e.Key == Key.Y) { menuEixoSelecao = 'y'; } else if (e.Key == Key.Z) { menuEixoSelecao = 'z'; } else if (e.Key == Key.Minus) { deslocamento--; } else if (e.Key == Key.Plus) { deslocamento++; } else if (e.Key == Key.C) { menuSelecao = "[menu] C: Câmera"; } else if (e.Key == Key.O) { menuSelecao = "[menu] O: Objeto"; } // Menu: seleção else if (menuSelecao.Equals("[menu] C: Câmera")) { camera.MenuTecla(e.Key, menuEixoSelecao, deslocamento); } else if (menuSelecao.Equals("[menu] O: Objeto")) { if (objetoSelecionado != null) { objetoSelecionado.MenuTecla(e.Key, menuEixoSelecao, deslocamento, bBoxDesenhar); } else { Console.WriteLine(" ... Objeto NÃO selecionado."); } } else { Console.WriteLine(" __ Tecla não implementada."); } if (!(e.Key == Key.LShift)) //FIXME: não funciona. { Console.WriteLine("__ " + menuSelecao + "[" + deslocamento + "]"); } }
protected override void OnKeyUp(OpenTK.Input.KeyboardKeyEventArgs e) { keyboardState = e.Keyboard; base.OnKeyDown(e); }