예제 #1
0
        private void DrawingSurface_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            if (_sdInterop == null)
            {
                _sdInterop = new SharpDXInterop();

                // Set window bounds in dips
                _sdInterop.WindowBounds = new Windows.Foundation.Size(
                    (float)DrawingSurface.ActualWidth,
                    (float)DrawingSurface.ActualHeight
                    );

                // Set native resolution in pixels
                _sdInterop.NativeResolution = new Windows.Foundation.Size(
                    (float)Math.Floor(DrawingSurface.ActualWidth * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f),
                    (float)Math.Floor(DrawingSurface.ActualHeight * Application.Current.Host.Content.ScaleFactor / 100.0f + 0.5f)
                    );

                // Set render resolution to the full native resolution
                _sdInterop.RenderResolution = _sdInterop.NativeResolution;

                // Hook-up native component to DrawingSurface
                DrawingSurface.SetContentProvider(_sdInterop.CreateContentProvider());
                DrawingSurface.SetManipulationHandler(_sdInterop);
            }

        }
예제 #2
0
        public SharpDXContentProvider(SharpDXInterop controller)
        {
            _controller = controller;

            _controller.RequestAdditionalFrame +=()=>{
                if (_host!=null)
                {
                    _host.RequestAdditionalFrame();
                }
            };

            _controller.RecreateSynchronizedTexture +=()=>{
                if (_host!=null)
                {
                    _synchronizedTexture = _host.CreateSynchronizedTexture(_controller.GetTexture());
                }
            };
        }
예제 #3
0
 public SharpDXContentProvider(SharpDXInterop controller)
 {
     _controller = controller;
 }