Exemplo n.º 1
0
        /** <summary> Initializes the keyboard listener. </summary> */
        public static void Initialize()
        {
            // States
            keys			= new InputControl[NumKeys];
            rawKeyDown		= new bool[NumKeys];
            rawKeyTyped		= new bool[NumKeys];
            charTyped		= '\0';
            rawCharTyped	= '\0';
            disabled		= false;

            // Setup
            for (int i = 0; i < NumKeys; i++) {
            keys[i]			= new InputControl();
            rawKeyDown[i]	= false;
            rawKeyTyped[i]	= false;
            }

            EventInput.CharEntered += delegate(object sender, CharacterEventArgs e) {
            rawCharTyped = e.Character;
            };
            EventInput.KeyDown += delegate(object sender, KeyEventArgs e) {
            rawKeyTyped[(int)e.KeyCode] = true;
            };
        }
Exemplo n.º 2
0
        /** <summary> Initializes the gamepad listener. </summary> */
        public static void Initialize()
        {
            // States
            buttons			= new InputControl[4, NumButtons];
            sticks			= new AnalogStick[4, NumSticks];
            triggers		= new Trigger[4, NumTriggers];
            disabled		= false;

            // Setup
            for (int i = 0; i < 4; i++) {
            for (int j = 0; j < NumButtons; j++)
                buttons[i, j] = new InputControl();
            for (int j = 0; j < NumSticks; j++)
                sticks[i, j] = new AnalogStick();
            for (int j = 0; j < NumTriggers; j++)
                triggers[i, j] = new Trigger();

            buttons[i, (int)Buttons.LeftStickRight]		= sticks[i, (int)Buttons.LeftStick].Right;
            buttons[i, (int)Buttons.LeftStickDown]		= sticks[i, (int)Buttons.LeftStick].Down;
            buttons[i, (int)Buttons.LeftStickLeft]		= sticks[i, (int)Buttons.LeftStick].Left;
            buttons[i, (int)Buttons.LeftStickUp]		= sticks[i, (int)Buttons.LeftStick].Up;

            buttons[i, (int)Buttons.RightStickRight]	= sticks[i, (int)Buttons.RightStick].Right;
            buttons[i, (int)Buttons.RightStickDown]		= sticks[i, (int)Buttons.RightStick].Down;
            buttons[i, (int)Buttons.RightStickLeft]		= sticks[i, (int)Buttons.RightStick].Left;
            buttons[i, (int)Buttons.RightStickUp]		= sticks[i, (int)Buttons.RightStick].Up;

            buttons[i, (int)Buttons.DPadRight]			= sticks[i, (int)Buttons.DPad].Right;
            buttons[i, (int)Buttons.DPadDown]			= sticks[i, (int)Buttons.DPad].Down;
            buttons[i, (int)Buttons.DPadLeft]			= sticks[i, (int)Buttons.DPad].Left;
            buttons[i, (int)Buttons.DPadUp]				= sticks[i, (int)Buttons.DPad].Up;
            sticks[i, (int)Buttons.DPad].DirectionDeadZone	= Vector2F.Zero;

            buttons[i, (int)Buttons.LeftTriggerButton]	= triggers[i, (int)Buttons.LeftTrigger].Button;
            buttons[i, (int)Buttons.RightTriggerButton]	= triggers[i, (int)Buttons.RightTrigger].Button;
            }
        }
Exemplo n.º 3
0
        /** <summary> Initializes the mouse listener. </summary> */
        public static void Initialize()
        {
            // States
            buttons					= new InputControl[NumButtons];
            rawButtonDown			= new bool[NumButtons];
            rawButtonDoubleClick	= new bool[NumButtons];
            rawButtonClick			= new bool[NumButtons];
            wheelDelta				= 0;
            rawWheelDelta			= 0;
            mousePos				= Vector2F.Zero;
            mousePosLast			= Vector2F.Zero;
            disabled				= false;
            gameScale				= 1.0;

            // Setup
            for (int i = 0; i < NumButtons; i++) {
            buttons[i]				= new InputControl();
            rawButtonDown[i]		= false;
            rawButtonDoubleClick[i]	= false;
            rawButtonClick[i]		= false;
            }
        }