2018-10-07 03:36:44 +00:00
|
|
|
#pragma once
|
2017-10-24 03:09:50 +00:00
|
|
|
|
|
|
|
#include "WinCommon.hpp"
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
struct Boo3DAppContextUWP : Boo3DAppContext {
|
|
|
|
bool isFullscreen(const boo::IWindow* window) {
|
2017-10-24 03:09:50 +00:00
|
|
|
#if _WIN32_WINNT_WIN10
|
2018-12-08 05:17:51 +00:00
|
|
|
if (m_ctx12.m_dev) {
|
|
|
|
D3D12Context::Window& win = m_ctx12.m_windows[window];
|
|
|
|
BOOL isFScr;
|
|
|
|
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
|
|
|
return isFScr != 0;
|
|
|
|
}
|
2017-10-24 03:09:50 +00:00
|
|
|
#endif
|
2018-12-08 05:17:51 +00:00
|
|
|
if (m_ctx11.m_dev) {
|
|
|
|
D3D11Context::Window& win = m_ctx11.m_windows[window];
|
|
|
|
BOOL isFScr;
|
|
|
|
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
|
|
|
return isFScr != 0;
|
2017-10-24 03:09:50 +00:00
|
|
|
}
|
2018-12-08 05:17:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-10-24 03:09:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
bool setFullscreen(boo::IWindow* window, bool fs) {
|
2017-10-24 03:09:50 +00:00
|
|
|
#if _WIN32_WINNT_WIN10
|
2018-12-08 05:17:51 +00:00
|
|
|
if (m_ctx12.m_dev) {
|
|
|
|
D3D12Context::Window& win = m_ctx12.m_windows[window];
|
|
|
|
BOOL isFScr;
|
|
|
|
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
|
|
|
if (fs && isFScr)
|
|
|
|
return false;
|
|
|
|
else if (!fs && !isFScr)
|
|
|
|
return false;
|
2017-10-24 03:09:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
if (fs) {
|
|
|
|
ComPtr<IDXGIOutput> out;
|
|
|
|
win.m_swapChain->GetContainingOutput(&out);
|
|
|
|
DXGI_OUTPUT_DESC outDesc;
|
|
|
|
out->GetDesc(&outDesc);
|
2017-10-24 03:09:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
win.m_swapChain->SetFullscreenState(true, nullptr);
|
|
|
|
DXGI_MODE_DESC mdesc = {UINT(outDesc.DesktopCoordinates.right - outDesc.DesktopCoordinates.left),
|
|
|
|
UINT(outDesc.DesktopCoordinates.bottom - outDesc.DesktopCoordinates.top)};
|
|
|
|
win.m_swapChain->ResizeTarget(&mdesc);
|
|
|
|
} else
|
|
|
|
win.m_swapChain->SetFullscreenState(false, nullptr);
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-24 03:09:50 +00:00
|
|
|
#endif
|
2018-12-08 05:17:51 +00:00
|
|
|
if (m_ctx11.m_dev) {
|
|
|
|
D3D11Context::Window& win = m_ctx11.m_windows[window];
|
|
|
|
BOOL isFScr;
|
|
|
|
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
|
|
|
if (fs && isFScr)
|
|
|
|
return false;
|
|
|
|
else if (!fs && !isFScr)
|
|
|
|
return false;
|
2017-10-24 03:09:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
if (fs) {
|
|
|
|
ComPtr<IDXGIOutput> out;
|
|
|
|
win.m_swapChain->GetContainingOutput(&out);
|
|
|
|
DXGI_OUTPUT_DESC outDesc;
|
|
|
|
out->GetDesc(&outDesc);
|
2017-10-24 03:09:50 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
win.m_fsdesc.Width = outDesc.DesktopCoordinates.right;
|
|
|
|
win.m_fsdesc.Height = outDesc.DesktopCoordinates.bottom;
|
|
|
|
}
|
|
|
|
win.m_fs = fs;
|
|
|
|
win.m_needsFSTransition = true;
|
|
|
|
return true;
|
2017-10-24 03:09:50 +00:00
|
|
|
}
|
2018-12-08 05:17:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-10-24 03:09:50 +00:00
|
|
|
};
|