/// <summary>
        /// Create a new instance of the dummy. The constructor will autom. add the instance itself to the <see cref="D3D11Host.Services"/> container of <see cref="host"/>.
        /// </summary>
        /// <param name="host"></param>
        public WpfGraphicsDeviceService(WpfGame host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (host.Services.GetService(typeof(IGraphicsDeviceService)) != null)
            {
                throw new NotSupportedException("A graphics device service is already registered.");
            }

            GraphicsDevice = host.GraphicsDevice;
            host.Services.AddService(typeof(IGraphicsDeviceService), this);
        }
コード例 #2
0
        /// <summary>
        /// Create a new instance of the dummy. The constructor will autom. add the instance itself to the <see cref="D3D11Host.Services"/> container of <see cref="host"/>.
        /// </summary>
        /// <param name="host"></param>
        public WpfGraphicsDeviceService(WpfGame host)
        {
            _host = host ?? throw new ArgumentNullException(nameof(host));

            if (host.Services.GetService(typeof(IGraphicsDeviceService)) != null)
            {
                throw new NotSupportedException("A graphics device service is already registered.");
            }

            if (host.GraphicsDevice == null)
            {
                throw new ArgumentException("Provided host graphics device is null.");
            }

            GraphicsDevice = host.GraphicsDevice;
            _host.GraphicsDevice.DeviceReset     += (sender, args) => DeviceReset?.Invoke(this, args);
            _host.GraphicsDevice.DeviceResetting += (sender, args) => DeviceResetting?.Invoke(this, args);

            host.Services.AddService(typeof(IGraphicsDeviceService), this);
            host.Services.AddService(typeof(IGraphicsDeviceManager), this);
        }
コード例 #3
0
 public WpfDrawableGameComponent(WpfGame game) : base(game)
 {
     _game = game;
 }
コード例 #4
0
 public WpfGameComponent(WpfGame game)
 {
     Game = game;
 }