コード例 #1
0
        private void InitControls()
        {
            inputContext = Window.CreateInput();
            context      = new ListenContext()
            {
                Active = true
            };

            Keyboard        = new Keyboard(inputContext);
            Mouse           = new Mouse(Screen, inputContext);
            PhoneBackButton = new BackButton();
            TouchPanel      = new TouchPanel();

            controllers     = new List <IController>();
            GameControllers = new List <GamePad>(4);

            GameControllers.Add(new GamePad(inputContext, 0));
            GameControllers.Add(new GamePad(inputContext, 1));
            GameControllers.Add(new GamePad(inputContext, 2));
            GameControllers.Add(new GamePad(inputContext, 3));
            controllers.AddRange(GameControllers);

            controllers.Add(Mouse);

            controllers.Add(Keyboard);

            controllers.Add(Accelerometer);
            controllers.Add(TouchPanel);

            controllers.Add(PhoneBackButton);
        }
コード例 #2
0
ファイル: Controls.cs プロジェクト: Anttifer/Jypeli
        private void InitControls()
        {
            _context = new ListenContext()
            {
                Active = true
            };

            Keyboard        = new Keyboard();
            Mouse           = new Mouse(Screen);
            PhoneBackButton = new BackButton();
            TouchPanel      = new TouchPanel(Screen);

            GameControllers = new List <GamePad>(4);
            GameControllers.Add(new GamePad(PlayerIndex.One));
            GameControllers.Add(new GamePad(PlayerIndex.Two));
            GameControllers.Add(new GamePad(PlayerIndex.Three));
            GameControllers.Add(new GamePad(PlayerIndex.Four));

            _controllers = new List <Controller>();
            _controllers.Add(Keyboard);
#if !WINDOWS_PHONE && !ANDROID
            _controllers.Add(Mouse);
#endif
            _controllers.Add(Accelerometer);
            _controllers.Add(TouchPanel);
#if WINDOWS_PHONE || ANDROID
            _controllers.Add(PhoneBackButton);
#endif
#if NETCOREAPP
            _controllers.AddRange(GameControllers);
#endif

            IsMouseVisible = true;
        }