mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-14 07:36:26 +00:00
Windows fixes; experimental UWP framework (not working)
This commit is contained in:
89
lib/win/UWPCommon.hpp
Normal file
89
lib/win/UWPCommon.hpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#ifndef BOO_UWPCOMMON_HPP
|
||||
#define BOO_UWPCOMMON_HPP
|
||||
|
||||
#include "WinCommon.hpp"
|
||||
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
|
||||
struct Boo3DAppContextUWP : Boo3DAppContext
|
||||
{
|
||||
bool isFullscreen(const boo::IWindow* window)
|
||||
{
|
||||
#if _WIN32_WINNT_WIN10
|
||||
if (m_ctx12.m_dev)
|
||||
{
|
||||
D3D12Context::Window& win = m_ctx12.m_windows[window];
|
||||
BOOL isFScr;
|
||||
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
||||
return isFScr != 0;
|
||||
}
|
||||
#endif
|
||||
if (m_ctx11.m_dev)
|
||||
{
|
||||
D3D11Context::Window& win = m_ctx11.m_windows[window];
|
||||
BOOL isFScr;
|
||||
win.m_swapChain->GetFullscreenState(&isFScr, nullptr);
|
||||
return isFScr != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool setFullscreen(boo::IWindow* window, bool fs)
|
||||
{
|
||||
#if _WIN32_WINNT_WIN10
|
||||
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;
|
||||
|
||||
if (fs)
|
||||
{
|
||||
ComPtr<IDXGIOutput> out;
|
||||
win.m_swapChain->GetContainingOutput(&out);
|
||||
DXGI_OUTPUT_DESC outDesc;
|
||||
out->GetDesc(&outDesc);
|
||||
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
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;
|
||||
|
||||
if (fs)
|
||||
{
|
||||
ComPtr<IDXGIOutput> out;
|
||||
win.m_swapChain->GetContainingOutput(&out);
|
||||
DXGI_OUTPUT_DESC outDesc;
|
||||
out->GetDesc(&outDesc);
|
||||
|
||||
win.m_fsdesc.Width = outDesc.DesktopCoordinates.right;
|
||||
win.m_fsdesc.Height = outDesc.DesktopCoordinates.bottom;
|
||||
}
|
||||
win.m_fs = fs;
|
||||
win.m_needsFSTransition = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BOO_UWPCOMMON_HPP
|
||||
Reference in New Issue
Block a user