Exemplo n.º 1
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     scroll        = builder.GetControl <Vector2Control>(this, "scroll");
     leftButton    = builder.GetControl <ButtonControl>(this, "leftButton");
     middleButton  = builder.GetControl <ButtonControl>(this, "middleButton");
     rightButton   = builder.GetControl <ButtonControl>(this, "rightButton");
     forwardButton = builder.GetControl <ButtonControl>(this, "forwardButton");
     backButton    = builder.GetControl <ButtonControl>(this, "backButton");
     clickCount    = builder.GetControl <IntegerControl>(this, "clickCount");
     base.FinishSetup(builder);
 }
Exemplo n.º 2
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     tip                = builder.GetControl <ButtonControl>("tip");
     eraser             = builder.GetControl <ButtonControl>("eraser");
     firstBarrelButton  = builder.GetControl <ButtonControl>("barrel1");
     secondBarrelButton = builder.GetControl <ButtonControl>("barrel2");
     thirdBarrelButton  = builder.GetControl <ButtonControl>("barrel3");
     fourthBarrelButton = builder.GetControl <ButtonControl>("barrel4");
     inRange            = builder.GetControl <ButtonControl>("inRange");
     base.FinishSetup(builder);
 }
Exemplo n.º 3
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            // Mandatory controls.
            trigger = builder.GetControl <ButtonControl>("{PrimaryTrigger}");
            stick   = builder.GetControl <StickControl>("{Primary2DMotion}");

            // Optional controls.
            twist = builder.TryGetControl <AxisControl>("{Twist}");
            hat   = builder.TryGetControl <DpadControl>("{Hatswitch}");

            base.FinishSetup(builder);
        }
Exemplo n.º 4
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            var touchArray = new TouchControl[TouchscreenState.kMaxTouches];

            for (var i = 0; i < TouchscreenState.kMaxTouches; ++i)
            {
                touchArray[i] = builder.GetControl <TouchControl>(this, "touch" + i);
            }

            allTouchControls     = new ReadOnlyArray <TouchControl>(touchArray);
            m_ActiveTouchesArray = new TouchControl[TouchscreenState.kMaxTouches];

            base.FinishSetup(builder);
        }
Exemplo n.º 5
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            position     = builder.GetControl <Vector2Control>(this, "position");
            delta        = builder.GetControl <Vector2Control>(this, "delta");
            tilt         = builder.GetControl <Vector2Control>(this, "tilt");
            radius       = builder.GetControl <Vector2Control>(this, "radius");
            pressure     = builder.GetControl <AxisControl>(this, "pressure");
            twist        = builder.GetControl <AxisControl>(this, "twist");
            pointerId    = builder.GetControl <IntegerControl>(this, "pointerId");
            phase        = builder.GetControl <PointerPhaseControl>(this, "phase");
            displayIndex = builder.GetControl <IntegerControl>(this, "displayIndex");
            button       = builder.GetControl <ButtonControl>(this, "button");

            base.FinishSetup(builder);
        }
Exemplo n.º 6
0
        private int ResolveInteractions(string interactionString)
        {
            ////REVIEW: We're piggybacking off the processor parsing here as the two syntaxes are identical. Might consider
            ////        moving the logic to a shared place.
            ////        Alternatively, may split the paths. May help in getting rid of unnecessary allocations.

            var firstInteractionIndex = totalInteractionCount;

            if (!InputControlLayout.ParseNameAndParameterList(interactionString, ref m_Parameters))
            {
                return(firstInteractionIndex);
            }

            for (var i = 0; i < m_Parameters.Count; ++i)
            {
                // Look up interaction.
                var type = InputInteraction.s_Interactions.LookupTypeRegistration(m_Parameters[i].name);
                if (type == null)
                {
                    throw new Exception(string.Format(
                                            "No interaction with name '{0}' (mentioned in '{1}') has been registered", m_Parameters[i].name,
                                            interactionString));
                }

                // Instantiate it.
                var interaction = Activator.CreateInstance(type) as IInputInteraction;
                if (interaction == null)
                {
                    throw new Exception(string.Format("Interaction '{0}' is not an IInputInteraction", m_Parameters[i].name));
                }

                // Pass parameters to it.
                InputDeviceBuilder.SetParameters(interaction, m_Parameters[i].parameters);

                // Add to list.
                var interactionStateCount = totalInteractionCount;
                ArrayHelpers.AppendWithCapacity(ref interactionStates, ref interactionStateCount,
                                                new InputActionMapState.InteractionState
                {
                    phase = InputActionPhase.Waiting
                });
                ArrayHelpers.AppendWithCapacity(ref interactions, ref totalInteractionCount, interaction);
                Debug.Assert(interactionStateCount == totalInteractionCount);
            }

            return(firstInteractionIndex);
        }
Exemplo n.º 7
0
        private static object InstantiateBindingComposite(string nameAndParameters)
        {
            var nameAndParametersParsed = InputControlLayout.ParseNameAndParameters(nameAndParameters);

            // Look up.
            var type = InputBindingComposite.s_Composites.LookupTypeRegistration(nameAndParametersParsed.name);

            if (type == null)
            {
                throw new Exception(string.Format("No binding composite with name '{0}' has been registered",
                                                  nameAndParametersParsed.name));
            }

            // Instantiate.
            var instance = Activator.CreateInstance(type);

            ////REVIEW: typecheck for IInputBindingComposite? (at least in dev builds)

            // Set parameters.
            InputDeviceBuilder.SetParameters(instance, nameAndParametersParsed.parameters);

            return(instance);
        }
Exemplo n.º 8
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            anyKey            = builder.GetControl <AnyKeyControl>("anyKey");
            spaceKey          = builder.GetControl <KeyControl>("space");
            enterKey          = builder.GetControl <KeyControl>("enter");
            tabKey            = builder.GetControl <KeyControl>("tab");
            backquoteKey      = builder.GetControl <KeyControl>("backquote");
            quoteKey          = builder.GetControl <KeyControl>("quote");
            semicolonKey      = builder.GetControl <KeyControl>("semicolon");
            commaKey          = builder.GetControl <KeyControl>("comma");
            periodKey         = builder.GetControl <KeyControl>("period");
            slashKey          = builder.GetControl <KeyControl>("slash");
            backslashKey      = builder.GetControl <KeyControl>("backslash");
            leftBracketKey    = builder.GetControl <KeyControl>("leftBracket");
            rightBracketKey   = builder.GetControl <KeyControl>("rightBracket");
            minusKey          = builder.GetControl <KeyControl>("minus");
            equalsKey         = builder.GetControl <KeyControl>("equals");
            aKey              = builder.GetControl <KeyControl>("a");
            bKey              = builder.GetControl <KeyControl>("b");
            cKey              = builder.GetControl <KeyControl>("c");
            dKey              = builder.GetControl <KeyControl>("d");
            eKey              = builder.GetControl <KeyControl>("e");
            fKey              = builder.GetControl <KeyControl>("f");
            gKey              = builder.GetControl <KeyControl>("g");
            hKey              = builder.GetControl <KeyControl>("h");
            iKey              = builder.GetControl <KeyControl>("i");
            jKey              = builder.GetControl <KeyControl>("j");
            kKey              = builder.GetControl <KeyControl>("k");
            lKey              = builder.GetControl <KeyControl>("l");
            mKey              = builder.GetControl <KeyControl>("m");
            nKey              = builder.GetControl <KeyControl>("n");
            oKey              = builder.GetControl <KeyControl>("o");
            pKey              = builder.GetControl <KeyControl>("p");
            qKey              = builder.GetControl <KeyControl>("q");
            rKey              = builder.GetControl <KeyControl>("r");
            sKey              = builder.GetControl <KeyControl>("s");
            tKey              = builder.GetControl <KeyControl>("t");
            uKey              = builder.GetControl <KeyControl>("u");
            vKey              = builder.GetControl <KeyControl>("v");
            wKey              = builder.GetControl <KeyControl>("w");
            xKey              = builder.GetControl <KeyControl>("x");
            yKey              = builder.GetControl <KeyControl>("y");
            zKey              = builder.GetControl <KeyControl>("z");
            digit1Key         = builder.GetControl <KeyControl>("1");
            digit2Key         = builder.GetControl <KeyControl>("2");
            digit3Key         = builder.GetControl <KeyControl>("3");
            digit4Key         = builder.GetControl <KeyControl>("4");
            digit5Key         = builder.GetControl <KeyControl>("5");
            digit6Key         = builder.GetControl <KeyControl>("6");
            digit7Key         = builder.GetControl <KeyControl>("7");
            digit8Key         = builder.GetControl <KeyControl>("8");
            digit9Key         = builder.GetControl <KeyControl>("9");
            digit0Key         = builder.GetControl <KeyControl>("0");
            leftShiftKey      = builder.GetControl <KeyControl>("leftShift");
            rightShiftKey     = builder.GetControl <KeyControl>("rightShift");
            leftAltKey        = builder.GetControl <KeyControl>("leftAlt");
            rightAltKey       = builder.GetControl <KeyControl>("rightAlt");
            leftCtrlKey       = builder.GetControl <KeyControl>("leftCtrl");
            rightCtrlKey      = builder.GetControl <KeyControl>("rightCtrl");
            leftMetaKey       = builder.GetControl <KeyControl>("leftMeta");
            rightMetaKey      = builder.GetControl <KeyControl>("rightMeta");
            leftWindowsKey    = builder.GetControl <KeyControl>("leftWindows");
            rightWindowsKey   = builder.GetControl <KeyControl>("rightWindows");
            leftAppleKey      = builder.GetControl <KeyControl>("leftApple");
            rightAppleKey     = builder.GetControl <KeyControl>("rightApple");
            leftCommandKey    = builder.GetControl <KeyControl>("leftCommand");
            rightCommandKey   = builder.GetControl <KeyControl>("rightCommand");
            contextMenuKey    = builder.GetControl <KeyControl>("contextMenu");
            escapeKey         = builder.GetControl <KeyControl>("escape");
            leftArrowKey      = builder.GetControl <KeyControl>("leftArrow");
            rightArrowKey     = builder.GetControl <KeyControl>("rightArrow");
            upArrowKey        = builder.GetControl <KeyControl>("upArrow");
            downArrowKey      = builder.GetControl <KeyControl>("downArrow");
            backspaceKey      = builder.GetControl <KeyControl>("backspace");
            pageDownKey       = builder.GetControl <KeyControl>("pageDown");
            pageUpKey         = builder.GetControl <KeyControl>("pageUp");
            homeKey           = builder.GetControl <KeyControl>("home");
            endKey            = builder.GetControl <KeyControl>("end");
            insertKey         = builder.GetControl <KeyControl>("insert");
            deleteKey         = builder.GetControl <KeyControl>("delete");
            numpadEnterKey    = builder.GetControl <KeyControl>("numpadEnter");
            numpadDivideKey   = builder.GetControl <KeyControl>("numpadDivide");
            numpadMultiplyKey = builder.GetControl <KeyControl>("numpadMultiply");
            numpadPlusKey     = builder.GetControl <KeyControl>("numpadPlus");
            numpadMinusKey    = builder.GetControl <KeyControl>("numpadMinus");
            numpadPeriodKey   = builder.GetControl <KeyControl>("numpadPeriod");
            numpadEqualsKey   = builder.GetControl <KeyControl>("numpadEquals");
            numpad0Key        = builder.GetControl <KeyControl>("numpad0");
            numpad1Key        = builder.GetControl <KeyControl>("numpad1");
            numpad2Key        = builder.GetControl <KeyControl>("numpad2");
            numpad3Key        = builder.GetControl <KeyControl>("numpad3");
            numpad4Key        = builder.GetControl <KeyControl>("numpad4");
            numpad5Key        = builder.GetControl <KeyControl>("numpad5");
            numpad6Key        = builder.GetControl <KeyControl>("numpad6");
            numpad7Key        = builder.GetControl <KeyControl>("numpad7");
            numpad8Key        = builder.GetControl <KeyControl>("numpad8");
            numpad9Key        = builder.GetControl <KeyControl>("numpad9");
            f1Key             = builder.GetControl <KeyControl>("f1");
            f2Key             = builder.GetControl <KeyControl>("f2");
            f3Key             = builder.GetControl <KeyControl>("f3");
            f4Key             = builder.GetControl <KeyControl>("f4");
            f5Key             = builder.GetControl <KeyControl>("f5");
            f6Key             = builder.GetControl <KeyControl>("f6");
            f7Key             = builder.GetControl <KeyControl>("f7");
            f8Key             = builder.GetControl <KeyControl>("f8");
            f9Key             = builder.GetControl <KeyControl>("f9");
            f10Key            = builder.GetControl <KeyControl>("f10");
            f11Key            = builder.GetControl <KeyControl>("f11");
            f12Key            = builder.GetControl <KeyControl>("f12");
            capsLockKey       = builder.GetControl <KeyControl>("capsLock");
            numLockKey        = builder.GetControl <KeyControl>("numLock");
            scrollLockKey     = builder.GetControl <KeyControl>("scrollLock");
            printScreenKey    = builder.GetControl <KeyControl>("printScreen");
            pauseKey          = builder.GetControl <KeyControl>("pause");
            oem1Key           = builder.GetControl <KeyControl>("OEM1");
            oem2Key           = builder.GetControl <KeyControl>("OEM2");
            oem3Key           = builder.GetControl <KeyControl>("OEM3");
            oem4Key           = builder.GetControl <KeyControl>("OEM4");
            oem5Key           = builder.GetControl <KeyControl>("OEM5");

            imeSelected = builder.GetControl <ButtonControl>("IMESelected");

            ////REVIEW: Ideally, we'd have a way to do this through layouts; this way nested key controls could work, too,
            ////        and it just seems somewhat dirty to jam the data into the control here

            // Assign key code to all keys.
            for (var key = 1; key < (int)Keyboard.KeyCount; ++key)
            {
                this[(Key)key].keyCode = (Key)key;
            }

            base.FinishSetup(builder);
        }
Exemplo n.º 9
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     acceleration = builder.GetControl <Vector3Control>("acceleration");
     base.FinishSetup(builder);
 }
Exemplo n.º 10
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     atmosphericPressure = builder.GetControl <AxisControl>("atmosphericPressure");
     base.FinishSetup(builder);
 }
Exemplo n.º 11
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     gravity = builder.GetControl <Vector3Control>("gravity");
     base.FinishSetup(builder);
 }
Exemplo n.º 12
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     attitude = builder.GetControl <QuaternionControl>("attitude");
     base.FinishSetup(builder);
 }
Exemplo n.º 13
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     lightLevel = builder.GetControl <AxisControl>("lightLevel");
     base.FinishSetup(builder);
 }
Exemplo n.º 14
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     angularVelocity = builder.GetControl <Vector3Control>("angularVelocity");
     base.FinishSetup(builder);
 }
Exemplo n.º 15
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     distance = builder.GetControl <AxisControl>("distance");
     base.FinishSetup(builder);
 }
Exemplo n.º 16
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     relativeHumidity = builder.GetControl <AxisControl>("relativeHumidity");
     base.FinishSetup(builder);
 }
Exemplo n.º 17
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            var keyStrings = new[]
            {
                "space",
                "enter",
                "tab",
                "backquote",
                "quote",
                "semicolon",
                "comma",
                "period",
                "slash",
                "backslash",
                "leftbracket",
                "rightbracket",
                "minus",
                "equals",
                "a",
                "b",
                "c",
                "d",
                "e",
                "f",
                "g",
                "h",
                "i",
                "j",
                "k",
                "l",
                "m",
                "n",
                "o",
                "p",
                "q",
                "r",
                "s",
                "t",
                "u",
                "v",
                "w",
                "x",
                "y",
                "z",
                "1",
                "2",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9",
                "0",
                "leftshift",
                "rightshift",
                "leftalt",
                "rightalt",
                "leftctrl",
                "rightctrl",
                "leftmeta",
                "rightmeta",
                "contextmenu",
                "escape",
                "leftarrow",
                "rightarrow",
                "uparrow",
                "downarrow",
                "backspace",
                "pagedown",
                "pageup",
                "home",
                "end",
                "insert",
                "delete",
                "capslock",
                "numlock",
                "printscreen",
                "scrolllock",
                "pause",
                "numpadenter",
                "numpaddivide",
                "numpadmultiply",
                "numpadplus",
                "numpadminus",
                "numpadperiod",
                "numpadequals",
                "numpad0",
                "numpad1",
                "numpad2",
                "numpad3",
                "numpad4",
                "numpad5",
                "numpad6",
                "numpad7",
                "numpad8",
                "numpad9",
                "f1",
                "f2",
                "f3",
                "f4",
                "f5",
                "f6",
                "f7",
                "f8",
                "f9",
                "f10",
                "f11",
                "f12",
                "oem1",
                "oem2",
                "oem3",
                "oem4",
                "oem5",
            };

            m_Keys = new KeyControl[keyStrings.Length];
            for (var i = 1; i < keyStrings.Length; i++)
            {
                m_Keys[i] = builder.GetControl <KeyControl>(keyStrings[i - 1]);

                ////REVIEW: Ideally, we'd have a way to do this through layouts; this way nested key controls could work, too,
                ////        and it just seems somewhat dirty to jam the data into the control here
                m_Keys[i].keyCode = (Key)i;
            }
            Debug.Assert(keyStrings[((int)Key.OEM5) - 1] == "oem5", "keyString array layout doe not match Key enum layout");
            anyKey      = builder.GetControl <AnyKeyControl>("anyKey");
            imeSelected = builder.GetControl <ButtonControl>("IMESelected");

            base.FinishSetup(builder);
        }
Exemplo n.º 18
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     stepCounter = builder.GetControl <IntegerControl>("stepCounter");
     base.FinishSetup(builder);
 }
Exemplo n.º 19
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     ambientTemperature = builder.GetControl <AxisControl>("ambientTemperature");
     base.FinishSetup(builder);
 }
Exemplo n.º 20
0
 ////REVIEW: replace InputDeviceBuilder here with an interface?
 // Set up of the control has been finalized. This can be used, for example, to look up
 // child controls for fast access.
 // NOTE: This function will be called repeatedly in case the setup is changed repeatedly.
 protected virtual void FinishSetup(InputDeviceBuilder builder)
 {
 }
Exemplo n.º 21
0
 protected override void FinishSetup(InputDeviceBuilder builder)
 {
     magneticField = builder.GetControl <Vector3Control>("magneticField");
     base.FinishSetup(builder);
 }