コード例 #1
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
        public bool CommandActivated(string command, Cv_Player player)
        {
            //Determine if the Keyboard input was pressed
            if (m_BindedKeys[player - 1].ContainsKey(command) &&
                KeyPressed(m_BindedKeys[player - 1][command]))
            {
                //Return true (no need to check game pad)
                return(true);
            }

            if (m_BindedMouseActions[player - 1].ContainsKey(command) &&
                MouseButtonPressed(m_BindedMouseActions[player - 1][command]))
            {
                return(true);
            }

            //Determine if the passed player's game pad input was pressed
            if (m_BindedButtons[player - 1].ContainsKey(command) &&
                ButtonPressed(m_BindedButtons[player - 1][command], player))
            {
                return(true);
            }

            //Othwerwise return false
            return(false);
        }
コード例 #2
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
        public Cv_GamepadValues GetGamepadValues(Cv_Player player)
        {
            var gamepadVals  = new Cv_GamepadValues();
            var gamepadState = m_GamePadStates[player - 1];

            gamepadVals.LeftThumbstick  = gamepadState.ThumbSticks.Left;
            gamepadVals.RightThumbstick = gamepadState.ThumbSticks.Right;
            gamepadVals.LeftTrigger     = gamepadState.Triggers.Left;
            gamepadVals.RightTrigger    = gamepadState.Triggers.Right;
            return(gamepadVals);
        }
コード例 #3
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
        public bool IsCommandBound(Cv_Player player, string command)
        {
            if (m_BindedKeys[player - 1].ContainsKey(command) ||
                m_BindedMouseActions[player - 1].ContainsKey(command) ||
                m_BindedButtons[player - 1].ContainsKey(command))
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
ファイル: CaravelApp.cs プロジェクト: jocamar/Caravel
        public Cv_PlayerView GetPlayerView(Cv_Player player)
        {
            foreach (var gv in Logic.GameViews)
            {
                if (gv.Type == Cv_GameViewType.Player)
                {
                    var pView = (Cv_PlayerView)gv;
                    if (pView.PlayerIdx == player)
                    {
                        return(pView);
                    }
                }
            }

            return(null);
        }
コード例 #5
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
        public bool CommandActive(string command, Cv_Player player)
        {
            //Determine if the Keyboard input is held down
            if (m_BindedKeys[player - 1].ContainsKey(command) &&
                KeyDown(m_BindedKeys[player - 1][command]))
            {
                //return true (no need to check game pad)
                return(true);
            }

            if (m_BindedMouseActions[player - 1].ContainsKey(command) &&
                m_BindedMouseActions[player - 1][command] == Cv_MouseAction.MouseWheelDown && MouseWheelDown())
            {
                return(true);
            }

            if (m_BindedMouseActions[player - 1].ContainsKey(command) &&
                m_BindedMouseActions[player - 1][command] == Cv_MouseAction.MouseWheelUp && MouseWheelUp())
            {
                return(true);
            }

            if (m_BindedMouseActions[player - 1].ContainsKey(command) &&
                m_BindedMouseActions[player - 1][command] == Cv_MouseAction.MouseMove && MouseMoved())
            {
                return(true);
            }

            if (m_BindedMouseActions[player - 1].ContainsKey(command) &&
                MouseButtonDown(m_BindedMouseActions[player - 1][command]))
            {
                return(true);
            }

            //Determine if the active player's game pad input is held down
            if (m_BindedButtons[player - 1].ContainsKey(command) &&
                ButtonDown(m_BindedButtons[player - 1][command], player))
            {
                return(true);
            }

            //otherwise return false
            return(false);
        }
コード例 #6
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 public void BindCommand(Cv_Player player, string command, Keys key)
 {
     m_BindedKeys[player - 1][command] = key;
 }
コード例 #7
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 private bool ButtonDown(Buttons button, Cv_Player index)
 {
     //Determine whether the button is down
     return(m_GamePadStates[index - 1].IsButtonDown(button));
 }
コード例 #8
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 private bool ButtonPressed(Buttons button, Cv_Player index)
 {
     //Determine whether the button has been pressed
     return(m_GamePadStates[index - 1].IsButtonDown(button) && m_LastGamePadStates[index - 1].IsButtonUp(button));
 }
コード例 #9
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 public void UnbindCommand(Cv_Player player, string command)
 {
     m_BindedKeys[player - 1].Remove(command);
     m_BindedButtons[player - 1].Remove(command);
     m_BindedMouseActions[player - 1].Remove(command);
 }
コード例 #10
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 public void BindCommand(Cv_Player player, string command, Cv_MouseAction button)
 {
     m_BindedMouseActions[player - 1][command] = button;
 }
コード例 #11
0
ファイル: Cv_InputManager.cs プロジェクト: jocamar/Caravel
 public void BindCommand(Cv_Player player, string command, Buttons button)
 {
     m_BindedButtons[player - 1][command] = button;
 }
コード例 #12
0
ファイル: EditorView.cs プロジェクト: jocamar/CaravelEditor
 public EditorView(Cv_Player player, SpriteBatch sb) : base(player, new Vector2(1, 1), Vector2.Zero, sb)
 {
     DebugDrawPhysicsShapes  = true;
     DebugDrawCameras        = true;
     DebugDrawClickableAreas = true;
 }