Example #1
0
        public InputComponent(Game game)
            : base(game)
        {
            InteractTrigger = new Trigger<bool>();
            ApplyTrigger = new Trigger<bool>();
            InventoryTrigger = new Trigger<bool>();
            JumpTrigger = new Trigger<bool>();
            SlotLeftTrigger = new Trigger<bool>();
            SlotRightTrigger = new Trigger<bool>();
            SlotTrigger = new Trigger<bool>[SlotTriggerLength];
            for (int i = 0; i < SlotTrigger.Length; i++)
                SlotTrigger[i] = new Trigger<bool>();

            gamepad = new GamePadInput();
            keyboard = new KeyboardInput();
            mouse = new MouseInput(game);
            screenMouse = new MouseScreenInput();

            inputDevices = new List<IInputSet>{
                gamepad,
                keyboard,
                mouse
            };

            screenInputDevices = new List<IScreenInputSet>{
                screenMouse
            };
        }
Example #2
0
        public InputComponent(Game game)
            : base(game)
        {
            InteractTrigger = new Trigger<bool>();
            ApplyTrigger = new Trigger<bool>();
            InventoryTrigger = new Trigger<bool>();
            JumpTrigger = new Trigger<bool>();
            SlotLeftTrigger = new Trigger<bool>();
            SlotRightTrigger = new Trigger<bool>();
            SlotTrigger = new Trigger<bool>[SlotTriggerLength];
            for (int i = 0; i < SlotTrigger.Length; i++)
                SlotTrigger[i] = new Trigger<bool>();

            gamepad = new GamePadInput();
            keyboard = new KeyboardInput();
            mouse = new MouseInput(game);
            screenMouse = new MouseScreenInput();
            screenKeyboard = new KeyboardScreenInput();

            screenKeyboard.OnKeyDown += (key) => { if (OnKeyDown != null) OnKeyDown(key); };
            screenKeyboard.OnKeyUp += (key) => { if (OnKeyUp != null) OnKeyUp(key); };
            screenMouse.OnLeftMouseUp += (position) => { if (OnLeftMouseUp != null) OnLeftMouseUp(position); };

            inputDevices = new List<IInputSet>{
                gamepad,
                keyboard,
                mouse
            };

            screenInputDevices = new List<IScreenInputSet>{
                screenMouse
            };
        }