public void ActionToExecute(float inputValue, IInputCheck inputCheck) { if (inputValue > 0f) { _parentGame.Exit(); } }
public void ActionToExecute(float inputValue, IInputCheck inputCheck) { if (Math.Abs(inputValue - 0) > MathValues.EPSILON) { Console.WriteLine( string.Format("Player received {0} input command {1} with value {2}", inputCheck.DeviceType.ToString().ToLower(), inputCheck.CommandName, inputValue)); if (inputCheck is GenericKeyboardValueInputCheck) { switch (inputCheck.CommandName) { case "move_left": case "move_right": AddImpulse(inputValue, "x"); break; case "move_up": case "move_down": AddImpulse(inputValue, "y"); break; } } if (inputCheck is DragInputCheckForMouse) { int x = (inputCheck as DragInputCheckForMouse).DragStartX; int y = (inputCheck as DragInputCheckForMouse).DragStartY; Console.WriteLine(string.Format("Drag started at ({0}, {1})", x, y)); } } }
public void SetKeyBinding(IInputCheck inputKey, IInputAction executeAction) { if (_keyBindings.ContainsKey(inputKey)) { _keyBindings[inputKey] = executeAction; } else { _keyBindings.Add(inputKey, executeAction); } }
public void ActionToExecute(float inputValue, IInputCheck inputCheck) { #if DEBUG if (inputValue <= 0f) { return; } IsDebugMode = !IsDebugMode; foreach (IEngineObject component in _parentGame.Components) { component.IsDebugMode = IsDebugMode; } #endif }
public void ActionToExecute(float inputValue, IInputCheck inputCheck) { if (inputValue > 0f) { if (_parentGraphics.IsFullScreen) { _parentGraphics.ChangeResolution(_width, _height, false); Console.WriteLine(string.Format("Switching to {0} x {1}, in windowed mode {2} {3} {4} {5}", _width, _height, inputValue, _parentGraphics.IsFullScreen, _parentGraphics.PreferredBackBufferWidth, _parentGraphics.PreferredBackBufferHeight)); } else { _parentGraphics.ChangeResolution(_parentGraphics.GraphicsDevice.Adapter.CurrentDisplayMode.Width, _parentGraphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height, true); Console.WriteLine(string.Format("Switching to {0} x {1}, in fullscreen mode {2} {3} {4} {5}", _width, _height, inputValue, _parentGraphics.IsFullScreen, _parentGraphics.PreferredBackBufferWidth, _parentGraphics.PreferredBackBufferHeight)); } } }
public ReplEngine(IInputCheck inputCheck, IScriptOptionsBuilder scriptOptionsBuilder) { _inputCheck = inputCheck; _scriptOptionsBuilder = scriptOptionsBuilder; }
public IInputAction GetKeyBinding(IInputCheck inputKey) { return(_keyBindings.ContainsKey(inputKey) ? _keyBindings[inputKey] : null); }