Graphics Reference
In-Depth Information
11. The D3DApp class itself is implemented in exactly the same way as we did for
the Rendering to a CoreWindow recipe, with the exception that it descends from
D3DAppSwapChainPanelTarget and the constructor looks like the following
code snippet:
class D3DApp: Common.D3DAppSwapChainPanelTarget
{
public D3DApp( Windows.UI.Xaml.Controls.SwapChainPanel
panel ) : base( panel )
{
this.VSync = true;
}
...
}
How it works…
The default constructor accepts a SwapChainPanel instance, attaches a handler to its
SizeChanged and CompositionScaleChanged events, and retrieves a reference to the
ISwapChainPanelNative interface. The SwapChainPanel XAML control descends from
Windows.UI.Xaml.Controls.Grid and therefore, supports layouts for child controls and
can be added as a child to other controls. As can be seen from the following sequence of
screenshots, the panel allows our Direct3D output to integrate with the XAML UI composition,
including user inputs, transitions, and storyboards:
SwapChainPanel with spinning cube, Hello World text, and an XAML stack panel child control, top: zoomed in and
zoomed out, bottom: transparency and XAML transformation applied through a storyboard.
 
Search WWH ::




Custom Search