コード例 #1
0
void D3D12Fullscreen::OnKeyDown(UINT8 key)
{
	switch (key)
	{
	case VK_SPACE:
		// Instrument the Space Bar to toggle between fullscreen states.
		// The CoreWindow will fire a SizeChanged event once the window is in the
		// fullscreen state. At that point, the IDXGISwapChain should be resized
		// to match the new window size.
	{
		auto applicationView = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
		if (applicationView->IsFullScreenMode)
		{
			applicationView->ExitFullScreenMode();
		}
		else
		{
			applicationView->TryEnterFullScreenMode();
		}
	}
	break;

	// Instrument the Right Arrow key to change the scene rendering resolution 
	// to the next resolution option. 
	case VK_RIGHT:
	{
		m_resolutionIndex = (m_resolutionIndex + 1) % m_resolutionOptionsCount;

		// Wait for the GPU to finish with the resources we're about to free.
		WaitForGpu();

		// Update resources dependent on the scene rendering resolution.
		LoadSceneResolutionDependentResources();
	}
	break;

	// Instrument the Left Arrow key to change the scene rendering resolution 
	// to the previous resolution option.
	case VK_LEFT:
	{
		if (m_resolutionIndex == 0)
		{
			m_resolutionIndex = m_resolutionOptionsCount - 1;
		}
		else
		{
			m_resolutionIndex--;
		}

		// Wait for the GPU to finish with the resources we're about to free.
		WaitForGpu();

		// Update resources dependent on the scene rendering resolution.
		LoadSceneResolutionDependentResources();
	}
	break;
	}
}
コード例 #2
0
void D3D12Fullscreen::OnKeyDown(UINT8 key)
{
	switch (key)
	{
	case VK_SPACE:
		// Instrument the Space Bar to toggle between fullscreen states.
		// The CoreWindow will fire a SizeChanged event once the window is in the
		// fullscreen state. At that point, the IDXGISwapChain should be resized
		// to match the new window size.
		{
			auto applicationView = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
			if (applicationView->IsFullScreenMode)
			{
				applicationView->ExitFullScreenMode();
			}
			else
			{
				applicationView->TryEnterFullScreenMode();
			}
		}
		break;
	}
}