diff --git a/README.md b/README.md index 5a14e188b..0bf30d8eb 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,11 @@ If you wish to integrate Wicked Engine into your own project, you can use it as - Directory of your built .lib file (For example ./x64/Release) 4. Also be sure to compile with a non-DLL runtime library for Release builds: - Project settings -> C/C++ -> Code Generation -> Runtime Library -> Multi threaded -5. If you want to create an UWP application, #define WINSTORE_SUPPORT preprocessor for the whole implementing project and link against the WickedEngine_UWP library. +5. If you want to create a UWP application, link against the WickedEngine_UWP library. When your project settings are set up, put `#include "WickedEngine.h"` in your source. This will enable the use of all the engine features and link the necessary binaries. After this, you should already be able to build your project. -If you have trouble, you can always look at or copy the project settings for Editor, Tests and Template projects to get an idea how to link with Wicked Engine. +If you have trouble, you can always look at or copy the project settings for Editor, Tests and Template application projects to get an idea how to link with Wicked Engine. Initialization example (C++): diff --git a/Template_UWP/App.cpp b/Template_UWP/App.cpp new file mode 100644 index 000000000..2049de9a6 --- /dev/null +++ b/Template_UWP/App.cpp @@ -0,0 +1,189 @@ +#include "pch.h" +#include "App.h" + +#include + +using namespace Template_UWP; + +using namespace concurrency; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; + +// The main function is only used to initialize our IFrameworkView class. +[Platform::MTAThread] +int main(Platform::Array^) +{ + auto direct3DApplicationSource = ref new Direct3DApplicationSource(); + CoreApplication::Run(direct3DApplicationSource); + return 0; +} + +IFrameworkView^ Direct3DApplicationSource::CreateView() +{ + return ref new App(); +} + +App::App() : + m_windowClosed(false), + m_windowVisible(true) +{ +} + +// The first method called when the IFrameworkView is being created. +void App::Initialize(CoreApplicationView^ applicationView) +{ + // Register event handlers for app lifecycle. This example includes Activated, so that we + // can make the CoreWindow active and start rendering on the window. + applicationView->Activated += + ref new TypedEventHandler(this, &App::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &App::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &App::OnResuming); + + main.infoDisplay.active = true; + main.infoDisplay.watermark = true; + main.infoDisplay.resolution = true; + main.infoDisplay.fpsinfo = true; + + // These folders are also copied to the executable folder in post-build script: + wiFont::SetFontPath("fonts/"); + wiRenderer::SetShaderPath("shaders/"); +} + +// Called when the CoreWindow object is created (or re-created). +void App::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += + ref new TypedEventHandler(this, &App::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &App::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &App::OnWindowClosed); + + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &App::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &App::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(this, &App::OnDisplayContentsInvalidated); + + main.SetWindow(wiPlatform::window_type(window)); +} + +// Initializes scene resources, or loads a previously saved app state. +void App::Load(Platform::String^ entryPoint) +{ +} + +// This method is called after the window becomes active. +void App::Run() +{ + while (!m_windowClosed) + { + if (m_windowVisible) + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + + main.Run(); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } +} + +// Required for IFrameworkView. +// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView +// class is torn down while the app is in the foreground. +void App::Uninitialize() +{ +} + +// Application lifecycle event handlers. + +void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +{ + // Run() won't start until the CoreWindow is activated. + CoreWindow::GetForCurrentThread()->Activate(); +} + +void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) +{ + // Save app state asynchronously after requesting a deferral. Holding a deferral + // indicates that the application is busy performing suspending operations. Be + // aware that a deferral may not be held indefinitely. After about five seconds, + // the app will be forced to exit. + SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); + + create_task([this, deferral]() + { + // Insert your code here. + + deferral->Complete(); + }); +} + +void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) +{ + // Restore any data or state that was unloaded on suspend. By default, data + // and state are persisted when resuming from suspend. Note that this event + // does not occur if the app was previously terminated. + + // Insert your code here. +} + +// Window event handlers. + +void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +{ + if (wiRenderer::GetDevice() != nullptr) + { + float dpiscale = wiPlatform::GetDPIScaling(); + wiRenderer::GetDevice()->SetResolution(int(sender->Bounds.Width * dpiscale), int(sender->Bounds.Height * dpiscale)); + wiRenderer::GetCamera().CreatePerspective((float)wiRenderer::GetInternalResolution().x, (float)wiRenderer::GetInternalResolution().y, 0.1f, 800); + } +} + +void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +{ + m_windowVisible = args->Visible; +} + +void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +{ + m_windowClosed = true; +} + +// DisplayInformation event handlers. + +void App::OnDpiChanged(DisplayInformation^ sender, Object^ args) +{ + // Note: The value for LogicalDpi retrieved here may not match the effective DPI of the app + // if it is being scaled for high resolution devices. Once the DPI is set on DeviceResources, + // you should always retrieve it using the GetDpi method. + // See DeviceResources.cpp for more details. +} + +void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args) +{ +} + +void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args) +{ +} \ No newline at end of file diff --git a/Template_UWP/App.h b/Template_UWP/App.h new file mode 100644 index 000000000..82f6fd305 --- /dev/null +++ b/Template_UWP/App.h @@ -0,0 +1,47 @@ +#pragma once + +#include "pch.h" + +namespace Template_UWP +{ + // Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events. + ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView + { + public: + App(); + + // IFrameworkView Methods. + virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); + virtual void SetWindow(Windows::UI::Core::CoreWindow^ window); + virtual void Load(Platform::String^ entryPoint); + virtual void Run(); + virtual void Uninitialize(); + + protected: + // Application lifecycle event handlers. + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); + void OnResuming(Platform::Object^ sender, Platform::Object^ args); + + // Window event handlers. + void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); + void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); + + // DisplayInformation event handlers. + void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + + private: + MainComponent main; + bool m_windowClosed; + bool m_windowVisible; + }; +} + +ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +{ +public: + virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView(); +}; diff --git a/Template_UWP/Assets/LockScreenLogo.scale-200.png b/Template_UWP/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 000000000..0b3e0bc74 Binary files /dev/null and b/Template_UWP/Assets/LockScreenLogo.scale-200.png differ diff --git a/Template_UWP/Assets/SplashScreen.scale-200.png b/Template_UWP/Assets/SplashScreen.scale-200.png new file mode 100644 index 000000000..c2daa8fee Binary files /dev/null and b/Template_UWP/Assets/SplashScreen.scale-200.png differ diff --git a/Template_UWP/Assets/Square150x150Logo.scale-200.png b/Template_UWP/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 000000000..4bf392469 Binary files /dev/null and b/Template_UWP/Assets/Square150x150Logo.scale-200.png differ diff --git a/Template_UWP/Assets/Square44x44Logo.scale-200.png b/Template_UWP/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 000000000..e8aab8a59 Binary files /dev/null and b/Template_UWP/Assets/Square44x44Logo.scale-200.png differ diff --git a/Template_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Template_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 000000000..2e49b5100 Binary files /dev/null and b/Template_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/Template_UWP/Assets/StoreLogo.png b/Template_UWP/Assets/StoreLogo.png new file mode 100644 index 000000000..8cfc7c0bd Binary files /dev/null and b/Template_UWP/Assets/StoreLogo.png differ diff --git a/Template_UWP/Assets/Wide310x150Logo.scale-200.png b/Template_UWP/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 000000000..e5d3d00b4 Binary files /dev/null and b/Template_UWP/Assets/Wide310x150Logo.scale-200.png differ diff --git a/Template_UWP/Package.appxmanifest b/Template_UWP/Package.appxmanifest new file mode 100644 index 000000000..bc334a9f1 --- /dev/null +++ b/Template_UWP/Package.appxmanifest @@ -0,0 +1,49 @@ + + + + + + + + + + Template_UWP + turan + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Template_UWP/Template_UWP.vcxproj b/Template_UWP/Template_UWP.vcxproj new file mode 100644 index 000000000..c89063a66 --- /dev/null +++ b/Template_UWP/Template_UWP.vcxproj @@ -0,0 +1,336 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + {c222218b-b6d1-406b-b2c0-8c1ced4a8d19} + DirectXApp + Template_UWP + en-US + 14.0 + true + Windows Store + 10.0.18362.0 + 10.0.17763.0 + 10.0 + false + + + + Application + true + v142 + + + Application + true + v142 + + + Application + true + v142 + true + + + Application + true + v142 + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + Application + false + true + v142 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64;../$(Platform)/$(Configuration) + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);../WickedEngine;%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + PerMonitorHighDPIAware + + + xcopy /Y /E /I $(SolutionDir)WickedEngine\shaders $(OutDir)AppX\shaders +xcopy /Y /E /I $(SolutionDir)WickedEngine\fonts $(OutDir)AppX\fonts + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + Designer + + + + + + + + + \ No newline at end of file diff --git a/Template_UWP/Template_UWP.vcxproj.filters b/Template_UWP/Template_UWP.vcxproj.filters new file mode 100644 index 000000000..46598cf2f --- /dev/null +++ b/Template_UWP/Template_UWP.vcxproj.filters @@ -0,0 +1,43 @@ + + + + + ffee1550-5669-47a8-9efa-342070932f48 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + + Assets + + + + + + \ No newline at end of file diff --git a/Template_UWP/pch.cpp b/Template_UWP/pch.cpp new file mode 100644 index 000000000..bcb5590be --- /dev/null +++ b/Template_UWP/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/Template_UWP/pch.h b/Template_UWP/pch.h new file mode 100644 index 000000000..303984fee --- /dev/null +++ b/Template_UWP/pch.h @@ -0,0 +1,2 @@ +#pragma once +#include "WickedEngine.h" diff --git a/WickedEngine.sln b/WickedEngine.sln index 18016e51d..1532830f2 100644 --- a/WickedEngine.sln +++ b/WickedEngine.sln @@ -17,6 +17,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WickedEngine_Windows", "Wic EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WickedEngine_UWP", "WickedEngine\WickedEngine_UWP.vcxproj", "{60DA258F-E95F-4CF4-A46B-17D80644464B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template_UWP", "Template_UWP\Template_UWP.vcxproj", "{C222218B-B6D1-406B-B2C0-8C1CED4A8D19}" + ProjectSection(ProjectDependencies) = postProject + {8C15DC72-70C8-4212-B046-0B166A688A7C} = {8C15DC72-70C8-4212-B046-0B166A688A7C} + {60DA258F-E95F-4CF4-A46B-17D80644464B} = {60DA258F-E95F-4CF4-A46B-17D80644464B} + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution WickedEngine\WickedEngine_SOURCE.vcxitems*{06163dcb-b183-4ed9-9c62-13ef1658e049}*SharedItemsImports = 4 @@ -25,77 +31,116 @@ Global EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|ARM.ActiveCfg = Debug|x64 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|Win32.ActiveCfg = Debug|Win32 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|Win32.Build.0 = Debug|Win32 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|x64.ActiveCfg = Debug|x64 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|x64.Build.0 = Debug|x64 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|ARM.ActiveCfg = Release|x64 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|Win32.ActiveCfg = Release|Win32 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|Win32.Build.0 = Release|Win32 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|x64.ActiveCfg = Release|x64 - {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|x64.Build.0 = Release|x64 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|ARM.ActiveCfg = Debug|ARM - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|ARM.Build.0 = Debug|ARM - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|Win32.ActiveCfg = Debug|Win32 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|Win32.Build.0 = Debug|Win32 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|x64.ActiveCfg = Debug|x64 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|x64.Build.0 = Debug|x64 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|ARM.ActiveCfg = Release|ARM - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|ARM.Build.0 = Release|ARM - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|Win32.ActiveCfg = Release|Win32 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|Win32.Build.0 = Release|Win32 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|x64.ActiveCfg = Release|x64 - {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|x64.Build.0 = Release|x64 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|ARM.ActiveCfg = Debug|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|ARM64.ActiveCfg = Debug|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|Win32.ActiveCfg = Debug|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|Win32.Build.0 = Debug|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|x64.ActiveCfg = Debug|x64 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|x64.Build.0 = Debug|x64 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|ARM.ActiveCfg = Release|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|ARM64.ActiveCfg = Release|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|Win32.ActiveCfg = Release|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|Win32.Build.0 = Release|Win32 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|x64.ActiveCfg = Release|x64 + {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|x64.Build.0 = Release|x64 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|ARM.ActiveCfg = Debug|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|ARM64.ActiveCfg = Debug|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|Win32.Build.0 = Debug|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|x64.ActiveCfg = Debug|x64 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|x64.Build.0 = Debug|x64 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|ARM.ActiveCfg = Release|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|ARM64.ActiveCfg = Release|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|Win32.ActiveCfg = Release|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|Win32.Build.0 = Release|Win32 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|x64.ActiveCfg = Release|x64 + {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|x64.Build.0 = Release|x64 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|ARM.ActiveCfg = Debug|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|ARM64.ActiveCfg = Debug|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|Win32.ActiveCfg = Debug|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|Win32.Build.0 = Debug|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|x64.ActiveCfg = Debug|x64 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|x64.Build.0 = Debug|x64 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|ARM.ActiveCfg = Release|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|ARM64.ActiveCfg = Release|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|Win32.ActiveCfg = Release|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|Win32.Build.0 = Release|Win32 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|x64.ActiveCfg = Release|x64 + {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|x64.Build.0 = Release|x64 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|ARM.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|ARM.Build.0 = Release|Win32 + {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|ARM64.ActiveCfg = Release|Win32 + {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|ARM64.Build.0 = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|Win32.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|Win32.Build.0 = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|x64.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Debug|x64.Build.0 = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|ARM.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|ARM.Build.0 = Release|Win32 + {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|ARM64.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|Win32.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|Win32.Build.0 = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|x64.ActiveCfg = Release|Win32 {8C15DC72-70C8-4212-B046-0B166A688A7C}.Release|x64.Build.0 = Release|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|ARM.ActiveCfg = Debug|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|Win32.ActiveCfg = Debug|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|Win32.Build.0 = Debug|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|x64.ActiveCfg = Debug|x64 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Debug|x64.Build.0 = Debug|x64 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|ARM.ActiveCfg = Release|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|Win32.ActiveCfg = Release|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|Win32.Build.0 = Release|Win32 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|x64.ActiveCfg = Release|x64 - {5FE97B9B-A445-4EEA-A42D-9DE60B891D48}.Release|x64.Build.0 = Release|x64 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|ARM.ActiveCfg = Debug|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|Win32.ActiveCfg = Debug|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|Win32.Build.0 = Debug|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|x64.ActiveCfg = Debug|x64 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Debug|x64.Build.0 = Debug|x64 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|ARM.ActiveCfg = Release|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|Win32.ActiveCfg = Release|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|Win32.Build.0 = Release|Win32 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|x64.ActiveCfg = Release|x64 - {3A9EA3D0-A795-46ED-A737-7164E90DC309}.Release|x64.Build.0 = Release|x64 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|ARM.ActiveCfg = Debug|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|Win32.ActiveCfg = Debug|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|Win32.Build.0 = Debug|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|x64.ActiveCfg = Debug|x64 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Debug|x64.Build.0 = Debug|x64 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|ARM.ActiveCfg = Release|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|Win32.ActiveCfg = Release|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|Win32.Build.0 = Release|Win32 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|x64.ActiveCfg = Release|x64 - {76AA3D37-3252-4785-9334-3FC6B8CC07DE}.Release|x64.Build.0 = Release|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|ARM.ActiveCfg = Debug|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|ARM64.ActiveCfg = Debug|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|Win32.ActiveCfg = Debug|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|Win32.Build.0 = Debug|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|x64.ActiveCfg = Debug|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Debug|x64.Build.0 = Debug|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|ARM.ActiveCfg = Release|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|ARM64.ActiveCfg = Release|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|Win32.ActiveCfg = Release|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|Win32.Build.0 = Release|Win32 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|x64.ActiveCfg = Release|x64 + {06163DCB-B183-4ED9-9C62-13EF1658E049}.Release|x64.Build.0 = Release|x64 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|ARM.ActiveCfg = Debug|ARM + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|ARM.Build.0 = Debug|ARM + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|ARM64.ActiveCfg = Debug|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|Win32.ActiveCfg = Debug|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|Win32.Build.0 = Debug|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|x64.ActiveCfg = Debug|x64 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Debug|x64.Build.0 = Debug|x64 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|ARM.ActiveCfg = Release|ARM + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|ARM.Build.0 = Release|ARM + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|ARM64.ActiveCfg = Release|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|Win32.ActiveCfg = Release|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|Win32.Build.0 = Release|Win32 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|x64.ActiveCfg = Release|x64 + {60DA258F-E95F-4CF4-A46B-17D80644464B}.Release|x64.Build.0 = Release|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM.ActiveCfg = Debug|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM.Build.0 = Debug|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM.Deploy.0 = Debug|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM64.Build.0 = Debug|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|Win32.ActiveCfg = Debug|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|Win32.Build.0 = Debug|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|Win32.Deploy.0 = Debug|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|x64.ActiveCfg = Debug|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|x64.Build.0 = Debug|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Debug|x64.Deploy.0 = Debug|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM.ActiveCfg = Release|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM.Build.0 = Release|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM.Deploy.0 = Release|ARM + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM64.ActiveCfg = Release|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM64.Build.0 = Release|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|ARM64.Deploy.0 = Release|ARM64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|Win32.ActiveCfg = Release|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|Win32.Build.0 = Release|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|Win32.Deploy.0 = Release|Win32 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|x64.ActiveCfg = Release|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|x64.Build.0 = Release|x64 + {C222218B-B6D1-406B-B2C0-8C1CED4A8D19}.Release|x64.Deploy.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WickedEngine/RenderPath.h b/WickedEngine/RenderPath.h index ce60278e8..35791f607 100644 --- a/WickedEngine/RenderPath.h +++ b/WickedEngine/RenderPath.h @@ -9,7 +9,7 @@ class RenderPath private: uint32_t layerMask = 0xFFFFFFFF; bool initial_resizebuffer = false; - uint32_t dpi = 0; + int dpi = 0; protected: // create resolution dependant resources, such as render targets diff --git a/WickedEngine/WickedEngine.h b/WickedEngine/WickedEngine.h index 6adce0feb..ca68b4784 100644 --- a/WickedEngine/WickedEngine.h +++ b/WickedEngine/WickedEngine.h @@ -22,6 +22,7 @@ // Engine-level systems #include "wiVersion.h" +#include "wiPlatform.h" #include "wiBackLog.h" #include "wiIntersect.h" #include "wiImage.h" @@ -63,11 +64,11 @@ #include "wiNetwork.h" #ifdef _WIN32 -#ifdef WINSTORE_SUPPORT +#ifdef PLATFORM_UWP #pragma comment(lib,"WickedEngine_UWP.lib") #else #pragma comment(lib,"WickedEngine_Windows.lib") -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP #endif // _WIN32 diff --git a/WickedEngine/WickedEngine_SOURCE.vcxitems b/WickedEngine/WickedEngine_SOURCE.vcxitems index 0e2d525c2..257eba833 100644 --- a/WickedEngine/WickedEngine_SOURCE.vcxitems +++ b/WickedEngine/WickedEngine_SOURCE.vcxitems @@ -696,16 +696,51 @@ - - - + + false + false + false + false + false + false + + + false + false + false + false + false + false + + + false + false + false + false + false + false + - - + + false + false + false + false + false + false + + + false + false + false + false + false + false + @@ -720,6 +755,13 @@ - + + false + false + false + false + false + false + \ No newline at end of file diff --git a/WickedEngine/WickedEngine_UWP.vcxproj b/WickedEngine/WickedEngine_UWP.vcxproj index c4b86de8b..4e3d11857 100644 --- a/WickedEngine/WickedEngine_UWP.vcxproj +++ b/WickedEngine/WickedEngine_UWP.vcxproj @@ -134,7 +134,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Console @@ -144,6 +144,8 @@ shaders/%(Filename).cso + + @@ -151,7 +153,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Console @@ -161,6 +163,8 @@ shaders/%(Filename).cso + + @@ -168,7 +172,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;BT_USE_DOUBLE_PRECISION;_ARM;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;BT_USE_DOUBLE_PRECISION;_ARM;%(PreprocessorDefinitions) Console @@ -178,6 +182,8 @@ shaders/%(Filename).cso + + @@ -185,7 +191,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;BT_USE_DOUBLE_PRECISION;_ARM;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;BT_USE_DOUBLE_PRECISION;_ARM;%(PreprocessorDefinitions) Console @@ -195,6 +201,8 @@ shaders/%(Filename).cso + + @@ -202,7 +210,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Console @@ -212,6 +220,8 @@ shaders/%(Filename).cso + + @@ -219,7 +229,7 @@ true true BULLET;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WINSTORE_SUPPORT;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Console @@ -229,6 +239,8 @@ shaders/%(Filename).cso + + diff --git a/WickedEngine/wiFont.cpp b/WickedEngine/wiFont.cpp index fb168be57..550ca29e0 100644 --- a/WickedEngine/wiFont.cpp +++ b/WickedEngine/wiFont.cpp @@ -364,8 +364,8 @@ void UpdatePendingGlyphs() { glyphLock.lock(); - static uint32_t saved_dpi = wiPlatform::GetDPI(); - uint32_t dpi = wiPlatform::GetDPI(); + static int saved_dpi = wiPlatform::GetDPI(); + int dpi = wiPlatform::GetDPI(); if (saved_dpi != dpi) { saved_dpi = dpi; diff --git a/WickedEngine/wiGraphicsDevice_DX11.cpp b/WickedEngine/wiGraphicsDevice_DX11.cpp index 368ec920a..c9892abf8 100644 --- a/WickedEngine/wiGraphicsDevice_DX11.cpp +++ b/WickedEngine/wiGraphicsDevice_DX11.cpp @@ -1186,14 +1186,15 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu DEBUGDEVICE = debuglayer; FULLSCREEN = fullscreen; -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP RECT rect = RECT(); GetClientRect(window, &rect); RESOLUTIONWIDTH = rect.right - rect.left; RESOLUTIONHEIGHT = rect.bottom - rect.top; -#else WINSTORE_SUPPORT - RESOLUTIONWIDTH = (int)window->Bounds.Width; - RESOLUTIONHEIGHT = (int)window->Bounds.Height; +#else PLATFORM_UWP + float dpiscale = wiPlatform::GetDPIScaling(); + RESOLUTIONWIDTH = int(window->Bounds.Width * dpiscale); + RESOLUTIONHEIGHT = int(window->Bounds.Height * dpiscale); #endif HRESULT hr = E_FAIL; @@ -1265,7 +1266,7 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu sd.Flags = 0; sd.AlphaMode = DXGI_ALPHA_MODE_IGNORE; -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; sd.Scaling = DXGI_SCALING_STRETCH; @@ -1280,7 +1281,7 @@ GraphicsDevice_DX11::GraphicsDevice_DX11(wiPlatform::window_type window, bool fu sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect. sd.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; - hr = pIDXGIFactory->CreateSwapChainForCoreWindow(device.Get(), reinterpret_cast(window), &sd, nullptr, &swapChain); + hr = pIDXGIFactory->CreateSwapChainForCoreWindow(device.Get(), reinterpret_cast(window.Get()), &sd, nullptr, &swapChain); #endif if (FAILED(hr)) diff --git a/WickedEngine/wiGraphicsDevice_DX12.cpp b/WickedEngine/wiGraphicsDevice_DX12.cpp index 23e021b8e..6652edd9a 100644 --- a/WickedEngine/wiGraphicsDevice_DX12.cpp +++ b/WickedEngine/wiGraphicsDevice_DX12.cpp @@ -1536,19 +1536,20 @@ using namespace DX12_Internal; DEBUGDEVICE = debuglayer; FULLSCREEN = fullscreen; -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP RECT rect = RECT(); GetClientRect(window, &rect); RESOLUTIONWIDTH = rect.right - rect.left; RESOLUTIONHEIGHT = rect.bottom - rect.top; -#else WINSTORE_SUPPORT - RESOLUTIONWIDTH = (int)window->Bounds.Width; - RESOLUTIONHEIGHT = (int)window->Bounds.Height; +#else PLATFORM_UWP + float dpiscale = wiPlatform::GetDPIScaling(); + RESOLUTIONWIDTH = int(window->Bounds.Width * dpiscale); + RESOLUTIONHEIGHT = int(window->Bounds.Height * dpiscale); #endif HRESULT hr = E_FAIL; -#if !defined(WINSTORE_SUPPORT) +#if !defined(PLATFORM_UWP) if (debuglayer) { // Enable the debug layer. @@ -1624,7 +1625,7 @@ using namespace DX12_Internal; sd.Flags = 0; sd.AlphaMode = DXGI_ALPHA_MODE_IGNORE; -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; sd.Scaling = DXGI_SCALING_STRETCH; @@ -1639,7 +1640,7 @@ using namespace DX12_Internal; sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect. sd.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH; - hr = pIDXGIFactory->CreateSwapChainForCoreWindow(directQueue.Get(), reinterpret_cast(window), &sd, nullptr, &_swapChain); + hr = pIDXGIFactory->CreateSwapChainForCoreWindow(directQueue.Get(), reinterpret_cast(window.Get()), &sd, nullptr, &_swapChain); #endif if (FAILED(hr)) diff --git a/WickedEngine/wiHelper.cpp b/WickedEngine/wiHelper.cpp index 78a313f3a..f3a1fddf5 100644 --- a/WickedEngine/wiHelper.cpp +++ b/WickedEngine/wiHelper.cpp @@ -51,7 +51,7 @@ namespace wiHelper void messageBox(const std::string& msg, const std::string& caption) { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP MessageBoxA(wiPlatform::GetWindow(), msg.c_str(), caption.c_str(), 0); #else wstring wmsg; @@ -224,7 +224,7 @@ namespace wiHelper void GetFilesInDirectory(std::vector& out, const std::string& directory) { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP // WINDOWS wstring wdirectory; StringConvert(directory, wdirectory); @@ -346,7 +346,7 @@ namespace wiHelper void FileDialog(const FileDialogParams& params, FileDialogResult& result) { #ifdef _WIN32 -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP char szFile[256]; @@ -410,7 +410,7 @@ namespace wiHelper result.filenames.push_back(ofn.lpstrFile); } -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP #endif // _WIN32 } diff --git a/WickedEngine/wiInput.cpp b/WickedEngine/wiInput.cpp index 1cf315d0e..ac106d2be 100644 --- a/WickedEngine/wiInput.cpp +++ b/WickedEngine/wiInput.cpp @@ -17,13 +17,13 @@ using namespace std; namespace wiInput { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP #define KEY_DOWN(vk_code) (GetAsyncKeyState(vk_code) < 0) #define KEY_TOGGLE(vk_code) ((GetAsyncKeyState(vk_code) & 1) != 0) #else #define KEY_DOWN(vk_code) ((int)Windows::UI::Core::CoreWindow::GetForCurrentThread()->GetAsyncKeyState((Windows::System::VirtualKey)vk_code) < 0) #define KEY_TOGGLE(vk_code) (((int)Windows::UI::Core::CoreWindow::GetForCurrentThread()->GetAsyncKeyState((Windows::System::VirtualKey)vk_code) & 1) != 0) -#endif //WINSTORE_SUPPORT +#endif //PLATFORM_UWP #define KEY_UP(vk_code) (!KEY_DOWN(vk_code)) @@ -390,7 +390,7 @@ namespace wiInput } XMFLOAT4 GetPointer() { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP POINT p; GetCursorPos(&p); ScreenToClient(wiPlatform::GetWindow(), &p); @@ -403,7 +403,7 @@ namespace wiInput } void SetPointer(const XMFLOAT4& props) { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP const float dpiscaling = wiPlatform::GetDPIScaling(); POINT p; p.x = (LONG)(props.x * dpiscaling); @@ -414,7 +414,7 @@ namespace wiInput } void HidePointer(bool value) { -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP if (value) { while (ShowCursor(false) >= 0) {}; @@ -462,7 +462,7 @@ namespace wiInput } -#ifdef WINSTORE_SUPPORT +#ifdef PLATFORM_UWP using namespace Windows::ApplicationModel; using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; @@ -498,20 +498,20 @@ namespace wiInput touch.pos = XMFLOAT2(p->Position.X, p->Position.Y); touches.push_back(touch); } -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP const std::vector& GetTouches() { static bool isRegisteredTouch = false; if (!isRegisteredTouch) { -#ifdef WINSTORE_SUPPORT +#ifdef PLATFORM_UWP auto window = CoreWindow::GetForCurrentThread(); window->PointerPressed += ref new TypedEventHandler(_OnPointerPressed); window->PointerReleased += ref new TypedEventHandler(_OnPointerReleased); window->PointerMoved += ref new TypedEventHandler(_OnPointerMoved); -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP isRegisteredTouch = true; } diff --git a/WickedEngine/wiNetwork_UWP.cpp b/WickedEngine/wiNetwork_UWP.cpp index 4a82a7fd1..5ec82ffef 100644 --- a/WickedEngine/wiNetwork_UWP.cpp +++ b/WickedEngine/wiNetwork_UWP.cpp @@ -1,4 +1,6 @@ -#ifdef WINSTORE_SUPPORT +#include "wiPlatform.h" + +#ifdef PLATFORM_UWP #include "wiNetwork.h" #include "wiBackLog.h" @@ -40,4 +42,4 @@ namespace wiNetwork } -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP diff --git a/WickedEngine/wiNetwork_Windows.cpp b/WickedEngine/wiNetwork_Windows.cpp index 6c00aa4f0..054c6d69c 100644 --- a/WickedEngine/wiNetwork_Windows.cpp +++ b/WickedEngine/wiNetwork_Windows.cpp @@ -1,4 +1,6 @@ -#ifndef WINSTORE_SUPPORT +#include "wiPlatform.h" + +#ifndef PLATFORM_UWP #include "wiNetwork.h" #include "wiBackLog.h" @@ -191,4 +193,4 @@ namespace wiNetwork } -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP diff --git a/WickedEngine/wiPlatform.h b/WickedEngine/wiPlatform.h index affa0216f..51e5db3b6 100644 --- a/WickedEngine/wiPlatform.h +++ b/WickedEngine/wiPlatform.h @@ -7,9 +7,11 @@ #include #include -#ifdef WINSTORE_SUPPORT +#if WINAPI_FAMILY == WINAPI_FAMILY_APP +#define PLATFORM_UWP #include -#endif // WINSTORE_SUPPORT +#include +#endif // UWP #endif // _WIN32 @@ -17,11 +19,11 @@ namespace wiPlatform { #ifdef _WIN32 -#ifndef WINSTORE_SUPPORT - typedef HWND window_type; +#ifndef PLATFORM_UWP + using window_type = HWND; #else - typedef Windows::UI::Core::CoreWindow^ window_type; -#endif // WINSTORE_SUPPORT + using window_type = Platform::Agile; +#endif // PLATFORM_UWP #endif // _WIN32 inline window_type& GetWindow() @@ -32,23 +34,23 @@ namespace wiPlatform inline bool IsWindowActive() { #ifdef _WIN32 -#ifndef WINSTORE_SUPPORT +#ifndef PLATFORM_UWP return GetForegroundWindow() == GetWindow(); #else return true; -#endif // WINSTORE_SUPPORT +#endif // PLATFORM_UWP #else return true; #endif // _WIN32 } - inline uint32_t GetDPI() + inline int GetDPI() { #ifdef _WIN32 -#ifndef WINSTORE_SUPPORT - return GetDpiForWindow(GetWindow()); +#ifndef PLATFORM_UWP + return (int)GetDpiForWindow(GetWindow()); #else - return 96; -#endif // WINSTORE_SUPPORT + return (int)Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->LogicalDpi; +#endif // PLATFORM_UWP #else return 96; #endif // _WIN32 diff --git a/WickedEngine/wiRawInput.cpp b/WickedEngine/wiRawInput.cpp index 3b2dbb4b2..20105150a 100644 --- a/WickedEngine/wiRawInput.cpp +++ b/WickedEngine/wiRawInput.cpp @@ -1,14 +1,13 @@ #include "wiRawInput.h" +#include "wiPlatform.h" -#if defined(_WIN32) && !defined(WINSTORE_SUPPORT) +#if defined(_WIN32) && !defined(PLATFORM_UWP) #include "wiAllocators.h" #include #include -#define WIN32_LEAN_AND_MEAN -#include #include #pragma comment(lib,"Hid.lib") diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index f479d17d2..0401e7d93 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 41; // minor bug fixes, alterations, refactors, updates - const int revision = 5; + const int revision = 6; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);