private void Inputs() { OpenTK.Input.KeyboardState state = OpenTK.Input.Keyboard.GetState(); if (state.IsKeyDown(Key.Space) && lastKeystate.IsKeyUp(Key.Space)) { autoRotate = !autoRotate; } this.lastKeystate = state; if (state.IsKeyDown(Key.A)) { left = true; } if (state.IsKeyDown(Key.S)) { down = true; } if (state.IsKeyDown(Key.D)) { right = true; } if (state.IsKeyDown(Key.W)) { up = true; } if (state.IsKeyUp(Key.A)) { left = false; } if (state.IsKeyUp(Key.S)) { down = false; } if (state.IsKeyUp(Key.D)) { right = false; } if (state.IsKeyUp(Key.W)) { up = false; } if (state.IsKeyDown(Key.Right)) { xdist = -0.05f; cube.SetTranslation(xdist, 'x'); } if (state.IsKeyDown(Key.Left)) { xdist = 0.05f; cube.SetTranslation(xdist, 'X'); } if (state.IsKeyDown(Key.Up)) { ydist = 0.05f; cube.SetTranslation(ydist, 'Y'); } if (state.IsKeyDown(Key.Down)) { ydist = -0.05f; cube.SetTranslation(ydist, 'Y'); } if (state.IsKeyDown(Key.Escape)) { this.Exit(); } }
public bool UpdateHotkeys(Inp.KeyboardState newKeyboardState, Inp.KeyboardState oldKeyboardState) { if (Hotkey != Inp.Key.Unknown && (newKeyboardState.IsKeyDown(Inp.Key.LControl) || newKeyboardState.IsKeyDown(Inp.Key.RControl)) && newKeyboardState.IsKeyDown(Hotkey) && oldKeyboardState.IsKeyUp(Hotkey)) { if (BoundBool != null) { BoundBool.Value = !BoundBool.Value; } if (OnActivate != null) { OnActivate(this); } Main.EndCutsceneMode(); if (SaveSettingsOnHotkey) { Main.SaveSettings(); } return(true); } return(false); }