A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/DirectXTK/wiki/Viewport below:

Viewport · microsoft/DirectXTK Wiki · GitHub

Viewport class modeled after the XNA Game Studio 4 (Microsoft.Xna.Framework.Viewport) graphics library.

using namespace DirectX::SimpleMath;

Viewport vp;                        // Creates the viewport [0,0,0,0,0,1]
Viewport vp(0,0,640,480);           // Creates the viewport [0,0,640,480,0,1]
Viewport vp(0,0,640,480,0.1f,0.9f); // Creates the viewport [0,0,640.480,0.1,0.9]

RECT rct;
rct.top = 0;
rct.left = 0;
rct.right = 640;
rct.bottom = 480;
Viewport vp(rct); // Creates the viewport [0,0,640,480,0,1]

If using ICoreWindow, be sure to convert logicalWidth and logicalHeight from DIPs to pixels using the window's DPI property. int ConvertDipsToPixels(float dips, float dpi) { return int(dips * dpi / 96.f + 0.5f); }

Note that the XNA Game Studio equivalent of this function only returned the reduced safe area on Xbox, and returns the full rectangle otherwise on Windows phone and PC. Because the Universal Windows Platform app can share a single binary or set of binaries across many devices, it is up to the app to determine what device it is currently running under. Therefore, this function always returns the reduced safe area and it is up to the app to apply this in the correct circumstances.

All SimpleMath methods are marked noexcept, and do not throw C++ exceptions.

If you include the SimpleMath.h header after you include d3d11.h, then the Viewport can be converted to and from a D3D11_VIEWPORT structure.

To use with Direct3D 11, you typically need an address of the viewport as a const D3D11_VIEWPORT* which is provided by Get11:

Viewport viewPort(0.0f, 0.0f, outputWidth, outputHeight);

context->RSSetViewports(1, viewPort.Get11());

If you include the SimpleMath.h header after you include d3d12.h, then the Viewport can be converted to and from a D3D12_VIEWPORT structure.

To use with Direct3D 12, you typically need an address of the viewport as a const D3D12_VIEWPORT* which is provided by Get12:

Viewport viewPort(0.0f, 0.0f, outputWidth, outputHeight);

commandList->RSSetViewports(1, viewPort.Get12());

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4