Inheritance: Grid, ISwapChainBackgroundPanel
        public D3DAppSwapChainBackgroundTarget(SwapChainBackgroundPanel panel)
        {
            this.backgroundPanel = panel;

            nativeBackgrounPanel = ToDispose(ComObject.As<SharpDX.DXGI.ISwapChainBackgroundPanelNative>(panel));
            this.backgroundPanel.SizeChanged += (sender, args) =>
            {
                SizeChanged();
            };
        }
        /// <summary>
        /// Initializes a new <see cref="SwapChainBackgroundPanelTarget"/> instance
        /// </summary>
        /// <param name="panel">The <see cref="SwapChainBackgroundPanel"/> to render to</param>
        public SwapChainBackgroundPanelTarget(SwapChainBackgroundPanel panel)
        {
            this.panel = panel;

            // Gets the native panel
            nativePanel = ComObject.As<ISwapChainBackgroundPanelNative>(panel);

            // Register event on Window Size Changed
            // So that resources dependent size can be resized
            Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GameContext" /> class.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="requestedWidth">Width of the requested.</param>
        /// <param name="requestedHeight">Height of the requested.</param>
        public GameContext(SwapChainBackgroundPanel control, int requestedWidth = 0, int requestedHeight = 0)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            Control = control;
            RequestedWidth = requestedWidth;
            RequestedHeight = requestedHeight;
            ContextType = GameContextType.WinRTBackgroundXaml;
        }
        /// <summary>
        /// Binds the object to a SwapChainBackgroundPanel and initializes Direct3D11 resources.
        /// </summary>
        /// <param name="backgroundPanel">SwapChainBackgroundPanel control used for drawing.</param>
        public void BindToControl(SwapChainBackgroundPanel backgroundPanel)
        {
            this.ThrowIfDisposed();
            this.ThrowIfBound();

            this.backgroundPanel = backgroundPanel;
            this.nativeBackgroundPanel = ComObject.As<ISwapChainBackgroundPanelNative>(this.backgroundPanel);
            this.UpdateBackBufferSize();

            this.CreateDeviceDependentResources();
            this.CreateSizeDependentResources();

            CompositionTarget.Rendering += CompositionTarget_Rendering;
            this.backgroundPanel.SizeChanged += HostControl_SizeChanged;
            DisplayInformation.GetForCurrentView().DpiChanged += DisplayInformation_DpiChanged;
            
            this.IsBound = true;
        }
Ejemplo n.º 5
0
 private XamlGraphicsDevice()
 {
     _panel = null;
     _ready = false;
     ClearColour = Color.Magenta;
 }
Ejemplo n.º 6
0
        private void BindSwapChainBackgroundPanel(SwapChainBackgroundPanel panel)
        {
            if (BackgroundPanel != null) throw new Exception("Background panel is already set");
            if (panel == null) throw new ArgumentNullException("panel");
            if (_swap == null) throw new Exception("Device must be initialised first");

            _panel = panel;
            SetChainToPanel();
        }
        internal override void Initialize(GameContext windowContext)
        {
            if (windowContext != null)
            {
                swapChainBackgroundPanel = windowContext.Control as SwapChainBackgroundPanel;
                if (swapChainBackgroundPanel == null)
                {
                    throw new NotSupportedException(string.Format("Unsupported window context [{0}]. Only  SwapChainBackgroundPanel",  windowContext.Control.GetType().FullName));
                }

                //clientBounds = new DrawingRectangle(0, 0, (int)swapChainBackgroundPanel.ActualWidth, (int)swapChainBackgroundPanel.ActualHeight);
                swapChainBackgroundPanel.SizeChanged += swapChainBackgroundPanel_SizeChanged;

            }
        }
Ejemplo n.º 8
0
        public static void Create(CCApplicationDelegate appDelegate, string launchArguments, Windows.UI.Core.CoreWindow coreWindow, SwapChainBackgroundPanel swapChainBackgroundPanel)
        {
            var game = MonoGame.Framework.XamlGame<CCGame>.Create(launchArguments, coreWindow, swapChainBackgroundPanel);
            foreach (var component in game.Components)
            {
                if (component is CCApplication)
                {
                    var instance = component as CCApplication;
                    instance.ApplicationDelegate = appDelegate;
                }
            }

        }
Ejemplo n.º 9
0
 public Player(SwapChainBackgroundPanel panel)
 {
 }
Ejemplo n.º 10
0
 public GameRenderer(SwapChainBackgroundPanel panel)
     : base(panel)
 {
 }
        /// <summary>
        /// Disposes this object's resources.
        /// </summary>
        /// <param name="disposing">true if releasing managed resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Utilities.Dispose(ref this.swapChain);

                DisplayInformation.GetForCurrentView().DpiChanged -= DisplayInformation_DpiChanged;
                CompositionTarget.Rendering -= CompositionTarget_Rendering;

                if (this.nativeBackgroundPanel != null)
                {
                    Utilities.Dispose(ref this.nativeBackgroundPanel);
                    this.backgroundPanel.SizeChanged -= HostControl_SizeChanged;
                }

                if (this.nativePanel != null)
                {
                    Utilities.Dispose(ref this.nativePanel);
                    this.panel.SizeChanged -= HostControl_SizeChanged;
                }

                this.backgroundPanel = null;
                this.panel = null;
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 12
0
 public async Task Initialize(SwapChainBackgroundPanel panel)
 {
     _vlcPlayer = new Player(panel);
     _vlcInitializeTask = _vlcPlayer.Initialize().AsTask();
     _vlcPlayer.MediaEnded += _vlcPlayer_MediaEnded;
     await _vlcInitializeTask;
 }
        public void SetGrid(object grid)
        {
#if WINDOWS_PHONE
           baseGrid = (DrawingSurfaceBackgroundGrid)grid;
#elif NETFX_CORE
            Debug.WriteLine(grid);
            backPanel = (SwapChainBackgroundPanel)grid;

#else
            //Unity or some such
            return;
#endif
        }