Last active
April 2, 2018 00:47
-
-
Save gyakoo/cfef3ca0403d26a082afc8c055240082 to your computer and use it in GitHub Desktop.
UWP C++ Fullscreen snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Made this code to change to fullscreen, useful if you're creating a DX application in vs2015/c++/uwp | |
// Also look at this sample: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/FullScreenMode/cpp | |
// And this MSDN page: https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.applicationview.preferredlaunchwindowingmode?cs-save-lang=1&cs-lang=cpp#code-snippet-1 | |
// preferred mode in constructor | |
App::App() | |
{ | |
// starts with this window size | |
Windows::UI::ViewManagement::ApplicationView::PreferredLaunchViewSize= Windows::Foundation::Size(800,600); | |
Windows::UI::ViewManagement::ApplicationView::PreferredLaunchWindowingMode = Windows::UI::ViewManagement::ApplicationViewWindowingMode::PreferredLaunchViewSize; | |
} | |
// call to this to set to FS | |
void App::ToggleToFullscreen() | |
{ | |
auto av = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView(); | |
if (!av->IsFullScreenMode) | |
{ | |
if (av->TryEnterFullScreenMode()) | |
{ | |
av->FullScreenSystemOverlayMode = Windows::UI::ViewManagement::FullScreenSystemOverlayMode::Minimal; | |
} | |
} | |
else | |
{ | |
av->ExitFullScreenMode(); | |
av->FullScreenSystemOverlayMode = Windows::UI::ViewManagement::FullScreenSystemOverlayMode::Standard; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment