Graphics Reference
In-Depth Information
using SharpDX.DXGI;
...
public abstract class D3DAppCoreWindowTarget
: D3DApplicationWinRT
{
// The CoreWindow this instance renders to
private CoreWindow _window;
public CoreWindow Window { get { return _window; } }
public D3DAppCoreWindowTarget(CoreWindow window)
{
_window = window;
Window.SizeChanged += (sender, args) =>
{
SizeChanged();
};
}
...
}
2.
Within our new class, we will now override the CurrentBounds property and the
CreateSwapChain function in order to return the correct size and create the swap
chain for the associated CoreWindow .
// Retrieve current bounds of CoreWindow
public override SharpDX.Rectangle CurrentBounds
{ get
{
return new SharpDX.Rectangle( (int)_window.Bounds.X,
(int)_window.Bounds.Y, (int)_window.Bounds.Width, (int)_window.
Bounds.Height);
}
}
// Create the swap chain
protected override SharpDX.DXGI.SwapChain1 CreateSwapChain(
SharpDX.DXGI.Factory2 factory,
SharpDX.Direct3D11.Device1 device,
SharpDX.DXGI.SwapChainDescription1 desc)
{
// Create the swap chain for the CoreWindow
using (var coreWindow = new ComObject(_window))
return new SwapChain1(factory, device, coreWindow,
ref desc);
}
 
Search WWH ::




Custom Search