예제 #1
0
        private void OnLoaded(object sender, EventArgs e)
        {
            UpdateTargetSize();

            InitializeXna();

            _d3dImage = new D3DImage();
            _d3dImage.Lock();

            try
            {
                _d3dImage.SetBackBuffer(
                    D3DResourceType.IDirect3DSurface9,
                    _frontBufferPointer);
            }
            finally
            {
                _d3dImage.Unlock();
            }

            _targetImage.Source = _d3dImage;

            if (_deviceManager.GraphicsDevice.GraphicsDeviceCapabilities.DeviceType == DeviceType.Hardware)
            {
                CompositionTarget.Rendering += OnCompositionTargetRendering;
            }
            else
            {
                _timer       = XnaHelper.CreateRenderTimer();
                _timer.Tick += OnCompositionTargetRendering;
                _timer.Start();
            }

            _stopwatch.Start();
        }
예제 #2
0
 public XnaTimer()
 {
     _timer       = XnaHelper.CreateRenderTimer();
     _timer.Tick += OnTick;
 }