예제 #1
0
        async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //launch camera stuff.
            var cameraPicker = new CameraDevicePickerWindow();

            cameraPicker.ShowDialog();

            var camera = cameraPicker.ChosenCamera;

            if (camera == null)
            {
                throw new InvalidOperationException("Can't run this sample application without a camera attached to your computer. Restart the program and try again.");
            }

            var captureDevice = new VideoCaptureDevice(camera.MonikerString);

            captureDevice.NewFrame += captureDevice_NewFrame;
            captureDevice.Start();

            //write the pokemon red ROM to the disk.
            var romPath = Path.Combine(Environment.CurrentDirectory, "PokemonRed.gb");

            if (!File.Exists(romPath))
            {
                File.WriteAllBytes(romPath, FileResources.PokemonRed);
            }

            await _engine.Start(romPath, GameboyArea);

            //now load the game.
            _engine.TapStart();
            _engine.LoadState();

            //start randomize loop.
            StartRandomizeLoop();
        }
예제 #2
0
        async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {

            //launch camera stuff.
            var cameraPicker = new CameraDevicePickerWindow();
            cameraPicker.ShowDialog();

            var camera = cameraPicker.ChosenCamera;
            if (camera == null)
            {
                throw new InvalidOperationException("Can't run this sample application without a camera attached to your computer. Restart the program and try again.");
            }

            var captureDevice = new VideoCaptureDevice(camera.MonikerString);

            captureDevice.NewFrame += captureDevice_NewFrame;
            captureDevice.Start();

            //write the pokemon red ROM to the disk.
            var romPath = Path.Combine(Environment.CurrentDirectory, "PokemonRed.gb");
            if (!File.Exists(romPath))
            {
                File.WriteAllBytes(romPath, FileResources.PokemonRed);
            }

            await _engine.Start(romPath, GameboyArea);

            //now load the game.
            _engine.TapStart();
            _engine.LoadState();

            //start randomize loop.
            StartRandomizeLoop();
        }