示例#1
0
        public Screen()
        {
            InitializeComponent();

            bmp = new WriteableBitmap(BitmapWidth, BitmapHeight, 96, 96, PixelFormats.Gray8, null);
            var whitescreen = new byte[BitmapWidth * BitmapHeight];

            for (int i = 0; i < whitescreen.Length; i++)
            {
                whitescreen[i] = 0xff;
            }
            bmp.WritePixels(new Int32Rect(0, 0, BitmapWidth, BitmapHeight), whitescreen, BitmapWidth, 0);
            Display.Source = bmp;
            RenderOptions.SetBitmapScalingMode(Display, BitmapScalingMode.NearestNeighbor);

            FPSDisplayEnable.Checked   += (x, y) => FPS.Visibility = Visibility.Visible;
            FPSDisplayEnable.Unchecked += (x, y) => FPS.Visibility = Visibility.Collapsed;

            XboxController.UpdateFrequency = 5;
            XboxController.StartPolling();

            var Controller1 = new XboxControllerWithInterruptHandler(XboxController.RetrieveController(0));
            var Controller2 = new XboxControllerWithInterruptHandler(XboxController.RetrieveController(1));
            var Controller3 = new XboxControllerWithInterruptHandler(XboxController.RetrieveController(2));
            var Controller4 = new XboxControllerWithInterruptHandler(XboxController.RetrieveController(3));

            Dictionary <Key, JoypadKey> mappedKeys = new()
            {
                { Key.X, JoypadKey.A },
                { Key.LeftShift, JoypadKey.Select },
 public IGameControllerXboxBridge(XboxControllerWithInterruptHandler xboxcontroller) => XboxController = xboxcontroller;