void device_DeviceResetting(object sender, EventArgs e) { if (DeviceResetting != null) { DeviceResetting.Invoke(sender, e); } }
public void ResetDevice(int width, int height) { DeviceResetting?.Invoke(this, EventArgs.Empty); _parameters.BackBufferWidth = Math.Max(_parameters.BackBufferWidth, width); _parameters.BackBufferHeight = Math.Max(_parameters.BackBufferHeight, height); GraphicsDevice.Reset(_parameters); DeviceReset?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Resets the graphics device to whichever is bigger out of the specified /// resolution or its current size. This behavior means the device will /// demand-grow to the largest of all its GraphicsDeviceControl clients. /// </summary> public void ResetDevice(int width, int height) { DeviceResetting?.Invoke(this, EventArgs.Empty); parameters.BackBufferWidth = Math.Max(parameters.BackBufferWidth, width); parameters.BackBufferHeight = Math.Max(parameters.BackBufferHeight, height); // TODO Replacement for this ? //graphicsDevice.Reset(parameters); DeviceReset?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Resets the graphics device to whichever is bigger out of the specified /// resolution or its current size. This behavior means the device will /// demand-grow to the largest of all its GraphicsDeviceControl clients. /// </summary> public void ResetDevice(int width, int height) { var newWidth = Math.Max(_parameters.BackBufferWidth, width); var newHeight = Math.Max(_parameters.BackBufferHeight, height); if (newWidth != _parameters.BackBufferWidth || newHeight != _parameters.BackBufferHeight) { DeviceResetting?.Invoke(this, EventArgs.Empty); _parameters.BackBufferWidth = newWidth; _parameters.BackBufferHeight = newHeight; GraphicsDevice.Reset(_parameters); DeviceReset?.Invoke(this, EventArgs.Empty); GraphicsDevice.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; } }
/// <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); }
protected virtual void OnDeviceResetting(object sender, EventArgs args) { DeviceResetting?.Invoke(sender, args); }
public void ResetDevice(int width, int height) { DeviceResetting?.Invoke(this, EventArgs.Empty); DeviceReset?.Invoke(this, EventArgs.Empty); }
protected void OnDeviceResetting(EventArgs e) => DeviceResetting?.Invoke(this, e);
// FIXME: Why does the GraphicsDeviceManager not know enough about the // GraphicsDevice to raise these events without help? internal void OnDeviceResetting() { DeviceResetting?.Invoke(this); }
private void GraphicsDevice_DeviceResetting(object sender, EventArgs e) { DeviceResetting?.Invoke(this, e); }