예제 #1
0
        private void Inputs_Sticks(ref float degrees)
        {
            //require mouselock to center of screen for mouse joystick mode.
            InputMouse.Mode       = MouseLockMode.Center;
            Memory.IsMouseVisible = false;
            // check mouse to move camera
            shift = InputMouse.Distance(MouseButtons.MouseToStick, maxLookSpeed);
            // check right stick to adjust camera
            shift += InputGamePad.Distance(GamePadButtons.RightStick, maxMoveSpeed);
            //convert stick readings to degrees
            degrees = (degrees + (int)shift.X) % 360;
            Yshift -= shift.Y;
            Yshift  = MathHelper.Clamp(Yshift, -80, 80);
            // grab left stick reading for moving camera position
            // storing signed value to detect direction of movement for left stick.
            left = InputGamePad.Distance(GamePadButtons.LeftStick, maxMoveSpeed);
            // convert to positive value to get distance traveled
            leftdist = left.Abs();

            if (leftdist == Vector2.Zero)
            {
                leftdist.Y = leftdist.X = (float)Input2.Distance(maxMoveSpeed);
            }
        }
예제 #2
0
파일: Input2.cs 프로젝트: stantoxt/OpenVIII
        public Input2(bool skip = false)
        {
            Memory.Log.WriteLine($"{nameof(Input2)} :: {this}");
            if (!skip)
            {
                if (Keyboard == null)
                {
                    Keyboard = new InputKeyboard();
                }
                if (Mouse == null)
                {
                    Mouse = new InputMouse();
                }
                if (GamePad == null)
                {
                    GamePad = new InputGamePad();
                }
                if (InputList == null)
                {
                    InputList = new List <Inputs>
                    {
                        new Inputs_FF8PSX(),
                        new Inputs_OpenVIII(),
                        new Inputs_FF8Steam(),
                        new Inputs_FF82000()
                    };

                    //remove duplicate inputs.
                    var j = 1;
                    foreach (var list in InputList)
                    {
                        for (var i = j; i < InputList.Count; i++)
                        {
                            foreach (var kvp in InputList[i].Data)
                            {
                                foreach (var inputs in kvp.Value.ToArray())
                                {
                                    if (
                                        list.Data.Any(
                                            x => x.Value.Any(y => y.Equals(inputs)
                                                             //x => x.Value.Any(y=>y.Key == inputs.Key &&
                                                             //y.MouseButton == inputs.MouseButton &&
                                                             //y.GamePadButton == inputs.GamePadButton &&
                                                             ////y.Trigger == inputs.Trigger //&&
                                                             //y.Combo == null//inputs.Combo
                                                             )))
                                    {
                                        kvp.Value.Remove(inputs);
                                    }
                                }
                            }
                        }
                        j++;
                    }
                }

                if (main == null)
                {
                    main = new Input2(true);
                }
                if (Convert_Button == null)
                {
                    Convert_Button = new Dictionary <Button_Flags, FF8TextTagKey>()
                    {
                        //Buttons is
                        //finisher = 0x0001
                        //up = 0x0010
                        //-> = 0x0020
                        //do = 0x0040
                        //< - = 0x0080
                        //L2 = 0x0100
                        //R2 = 0x0200
                        //L1 = 0x0400
                        //R1 = 0x0800
                        // /\ = 0x1000
                        //O = 0x2000
                        //X = 0x4000
                        //| _ |= 0x8000
                        //None = 0xFFFF

                        { Button_Flags.Up, FF8TextTagKey.Up },
                        { Button_Flags.Right, FF8TextTagKey.Right },
                        { Button_Flags.Down, FF8TextTagKey.Down },
                        { Button_Flags.Left, FF8TextTagKey.Left },
                        { Button_Flags.L2, FF8TextTagKey.EscapeLeft },
                        { Button_Flags.R2, FF8TextTagKey.EscapeRight },
                        { Button_Flags.L1, FF8TextTagKey.RotateLeft },
                        { Button_Flags.R1, FF8TextTagKey.RotateRight },
                        { Button_Flags.Triangle, FF8TextTagKey.Cancel },
                        { Button_Flags.Circle, FF8TextTagKey.Menu },
                        { Button_Flags.Cross, FF8TextTagKey.Confirm },
                        { Button_Flags.Square, FF8TextTagKey.Cards }
                    };
                }
            }
        }