Beispiel #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();
        }
Beispiel #2
0
        private void CreateDevice()
        {
            _device = XnaHelper.CreateDevice(_targetSize, false, false, false);

            _usePostProcessor = _device.GraphicsDeviceCapabilities.DeviceType == DeviceType.Hardware &&
                                _device.GraphicsDeviceCapabilities.MaxPixelShaderProfile >= ShaderProfile.PS_3_0;
        }
Beispiel #3
0
        private void CreateDevice()
        {
            _device = XnaHelper.CreateDevice(
                _targetSize,
                true,
                true,
                true);

            if (_deviceDepthStencilBuffer != null &&
                _deviceDepthStencilBuffer != _device.DepthStencilBuffer &&
                !_deviceDepthStencilBuffer.IsDisposed)
            {
                _deviceDepthStencilBuffer.Dispose();
            }

            _deviceDepthStencilBuffer = _device.DepthStencilBuffer;
        }
Beispiel #4
0
        private void PreInitialize()
        {
            _graphicsDeviceService = _graphicsDeviceManager = XnaHelper.CreateDeviceManager(this);
            _content = new ContentManager(_services, ResourceManager.WorkingDirectory);

            HookDeviceEvents();

            _graphicsDeviceManager.CreateDevice();

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

            try
            {
                _d3DImage.SetBackBuffer(
                    D3DResourceType.IDirect3DSurface9,
                    _frontBufferPointer);
            }
            finally
            {
                _d3DImage.Unlock();
            }
        }
Beispiel #5
0
 public XnaTimer()
 {
     _timer       = XnaHelper.CreateRenderTimer();
     _timer.Tick += OnTick;
 }