private void F2Action(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press) { reverseY = !reverseY; } }
protected override void Start() { up = Input.Key.w; down = Input.Key.s; left = Input.Key.a; right = Input.Key.d; }
private void ChangeFOVAction(Input.Key key, Input.KeyAction action) { if (action != Input.KeyAction.Repeat && action != Input.KeyAction.Press) { return; } var camera = this.Entity.GetComponent <Camera>(); var fov = camera.FieldOfView; if (key == Input.Key.Equal) { fov += 1.0f; if (fov > 170.0f) { fov = 170.0f; } } else { fov -= 1.0f; if (fov < 10.0f) { fov = 10.0f; } } camera.FieldOfView = fov; }
private void EscapeAction(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press) { Application.Exit(); } }
private void ChangedOptionValueAction(Input.Key key, Input.KeyAction action) { if (action != Input.KeyAction.Press && action != Input.KeyAction.Repeat) { return; } if (options.Count == 0) { return; } int value = 1; if (Input.IsKeyPressed(Input.Key.LeftShift)) { value = 3; } if (key == Input.Key.Kp8) { options[currentOption].Changed(value); } if (key == Input.Key.Kp2) { options[currentOption].Changed(-value); } Console.WriteLine($"{options[currentOption].Name} = {options[currentOption].Value}"); }
private void ResizeUp(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press && light != null) { light.TextureSize = light.TextureSize * 2; Console.WriteLine("Pressed: " + light.TextureSize); } }
private void BoostAction(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press) { this.boost = BoostMultiplier; } if (action == Input.KeyAction.Release) { this.boost = 1.0f; } }
private void ChangeShader2(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press) { var resourceManager = ResourceManager.Instance; var renderable = this.Entity.GetComponent <Renderable>(); renderable.UseDeferredShader(resourceManager.GetResource <Shader>("TestDeferred2")); renderable.DeferredShader.Material.DiffuseTexture = resourceManager.GetResource <Texture>("Numbers"); renderable.Mesh = resourceManager.GetResource <Mesh>("Skull"); } }
private void CurrentOptionAction(Input.Key key, Input.KeyAction action) { if (action != Input.KeyAction.Press) { return; } if (options.Count == 0) { return; } Console.WriteLine($"Current option: {options[currentOption].Name} = {options[currentOption].Value}"); }
private void ChangeShader1(Input.Key key, Input.KeyAction action) { if (action == Input.KeyAction.Press) { var resourceManager = ResourceManager.Instance; var renderable = this.Entity.GetComponent <Renderable>(); renderable.UseDeferredShader(resourceManager.GetResource <Shader>("TestDeferred1")); renderable.DeferredShader.Material.Diffuse = new Vector3f((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble()); renderable.Mesh = resourceManager.GetResource <Mesh>("EngineQ/Cube"); Console.WriteLine($"Set diffuse color to {renderable.DeferredShader.Material.Diffuse}"); } }
private void ChangedOptionAnction(Input.Key key, Input.KeyAction action) { if (action != Input.KeyAction.Press && action != Input.KeyAction.Repeat) { return; } if (options.Count == 0) { Console.WriteLine("<No options>"); return; } if (key == Input.Key.Kp4) { currentOption = (currentOption + 1) % options.Count; } if (key == Input.Key.Kp6) { currentOption = (currentOption + options.Count - 1) % options.Count; } Console.WriteLine($"Selected option: {options[currentOption].Name} = {options[currentOption].Value}"); }
public static VirtualKey ToVirtual(this Input.Key key) { return((VirtualKey)System.Windows.Input.KeyInterop.VirtualKeyFromKey((System.Windows.Input.Key)key)); }
private void SwitchAction(Input.Key key, Input.KeyAction action) { mode = (mode + 1) % 3; }