コード例 #1
0
ファイル: ExitInputAction.cs プロジェクト: indusninja/bocce
 public void ActionToExecute(float inputValue, IInputCheck inputCheck)
 {
     if (inputValue > 0f)
     {
         _parentGame.Exit();
     }
 }
コード例 #2
0
        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));
                }
            }
        }
コード例 #3
0
 public void SetKeyBinding(IInputCheck inputKey, IInputAction executeAction)
 {
     if (_keyBindings.ContainsKey(inputKey))
     {
         _keyBindings[inputKey] = executeAction;
     }
     else
     {
         _keyBindings.Add(inputKey, executeAction);
     }
 }
コード例 #4
0
        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
        }
コード例 #5
0
 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));
         }
     }
 }
コード例 #6
0
ファイル: ReplEngine.cs プロジェクト: rayvega/repltap
 public ReplEngine(IInputCheck inputCheck, IScriptOptionsBuilder scriptOptionsBuilder)
 {
     _inputCheck           = inputCheck;
     _scriptOptionsBuilder = scriptOptionsBuilder;
 }
コード例 #7
0
 public IInputAction GetKeyBinding(IInputCheck inputKey)
 {
     return(_keyBindings.ContainsKey(inputKey) ? _keyBindings[inputKey] : null);
 }