示例#1
0
        private void Update()
        {
            if (!_frameSent)
            {
                var frameTex = UnityEngine.Resources.Load <Texture2D>("Textures/vpe_dmd_32x128");
                var data     = frameTex.GetRawTextureData <byte>().ToArray();

                // this texture happens to be stored as RGB24, so we can send the raw data directly.
                OnDisplayFrame?.Invoke(this, new DisplayFrameData(DisplayDmd, DisplayFrameFormat.Dmd24, data));

                _frameSent = true;
            }

            if (Keyboard.current.fKey.wasPressedThisFrame)
            {
                Debug.Log("Flippers disabled");
                _flippersEnabled = false;
            }

            if (Keyboard.current.fKey.wasReleasedThisFrame)
            {
                Debug.Log("Flippers enabled");
                _flippersEnabled = true;
            }
        }
示例#2
0
        private void OnDmdFrame(object sender, SetDmdFrameRequest frame)
        {
            Logger.Info($"<-- dmd frame: {frame.Name}");
            if (!_displaysAnnounced)
            {
                _displaysAnnounced = true;
                var config = _api.GetMachineDescription();
                Logger.Info($"[MPF] Announcing {config.Dmds} display(s)");
                foreach (var dmd in config.Dmds)
                {
                    Logger.Info($"[MPF] Announcing display \"{dmd.Name}\" @ {dmd.Width}x{dmd.Height}");
                    lock (_dispatchQueue) {
                        _dispatchQueue.Enqueue(() => OnDisplaysAvailable?.Invoke(this,
                                                                                 new AvailableDisplays(new DisplayConfig(dmd.Name, dmd.Width, dmd.Height, true))));
                    }
                }
                Logger.Info("[MPF] Displays announced.");
            }

            lock (_dispatchQueue) {
                _dispatchQueue.Enqueue(() => OnDisplayFrame?.Invoke(this,
                                                                    new DisplayFrameData(frame.Name, DisplayFrameFormat.Dmd24, frame.FrameData())));
            }
        }