diff --git a/dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj b/dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj index 46c3503..0655dc8 100644 --- a/dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj +++ b/dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj @@ -90,10 +90,10 @@ true - true - true - true - true + false + false + false + false true @@ -108,8 +108,10 @@ true - false - false + true + true + true + true true diff --git a/dev/src/core.cpp b/dev/src/core.cpp index b170c9e..c3af8ab 100644 --- a/dev/src/core.cpp +++ b/dev/src/core.cpp @@ -77,11 +77,17 @@ namespace olc //pRenderer->RetargetDevice(pHost->GetHostWindowDescriptor(this)); pRenderer->PrepareWindowTarget(pHost->GetHostWindowDescriptor(this)); CreateImage(GetScreen(), vScreenSize); - SetWindowSize(vScreenSize * vPixelSize); + + olc::vi2d vPS = vPixelSize; + if (config.bRealWindow) + vPS = { 1,1 }; + + + SetWindowSize(vScreenSize * vPS); // Assume 1:1 Relationship for now vViewPos = { 0,0 }; - vViewSize = vScreenSize * vPixelSize; + vViewSize = vScreenSize * vPS; return true; } @@ -383,6 +389,16 @@ namespace olc return true; } + bool PGEWindow::olc_OnWindowSize(const olc::vi2d& vSize) + { + if (config.bRealWindow) + { + GetScreen().Resize(vSize); + } + + return SetWindowSize(vSize); + } + @@ -407,8 +423,12 @@ namespace olc bool PixelGameEngine::Construct(const PGEConfig& cfg) { config = cfg; + + if (config.bRealWindow) + config.vPixelSize = { 1,1 }; + // Also assign the window level config since that is what the Host will see - Window::config = cfg; + Window::config = config; // Check for constructor sAppName, if not set use Config sAppName if (sAppName.empty()) diff --git a/dev/src/core.h b/dev/src/core.h index 46db13b..43e1a76 100644 --- a/dev/src/core.h +++ b/dev/src/core.h @@ -133,6 +133,7 @@ namespace olc protected: bool olc_OnMouseMove(const olc::vi2d& vMousePos) override; bool olc_OnTouch(const uint32_t nID, const olc::vf2d& vPos, const bool bPress, const bool bRelease, const olc::vf2d& vSize, const bool stylus = false, const float pressure = 0.0f, const float orientation = 0, const olc::vf2d& tilt = { 0,0 }) override; + bool olc_OnWindowSize(const olc::vi2d& vSize) override; public: virtual bool olc_WindowUpdate(const float fElapsedTime, const float fTotalElapsedTime); diff --git a/olcPixelGameEngine3.h b/olcPixelGameEngine3.h index edd73b2..fe1761c 100644 --- a/olcPixelGameEngine3.h +++ b/olcPixelGameEngine3.h @@ -4426,6 +4426,7 @@ namespace olc protected: bool olc_OnMouseMove(const olc::vi2d& vMousePos) override; bool olc_OnTouch(const uint32_t nID, const olc::vf2d& vPos, const bool bPress, const bool bRelease, const olc::vf2d& vSize, const bool stylus = false, const float pressure = 0.0f, const float orientation = 0, const olc::vf2d& tilt = { 0,0 }) override; + bool olc_OnWindowSize(const olc::vi2d& vSize) override; public: virtual bool olc_WindowUpdate(const float fElapsedTime, const float fTotalElapsedTime); @@ -19971,11 +19972,17 @@ namespace olc //pRenderer->RetargetDevice(pHost->GetHostWindowDescriptor(this)); pRenderer->PrepareWindowTarget(pHost->GetHostWindowDescriptor(this)); CreateImage(GetScreen(), vScreenSize); - SetWindowSize(vScreenSize * vPixelSize); + + olc::vi2d vPS = vPixelSize; + if (config.bRealWindow) + vPS = { 1,1 }; + + + SetWindowSize(vScreenSize * vPS); // Assume 1:1 Relationship for now vViewPos = { 0,0 }; - vViewSize = vScreenSize * vPixelSize; + vViewSize = vScreenSize * vPS; return true; } @@ -20277,6 +20284,16 @@ namespace olc return true; } + bool PGEWindow::olc_OnWindowSize(const olc::vi2d& vSize) + { + if (config.bRealWindow) + { + GetScreen().Resize(vSize); + } + + return SetWindowSize(vSize); + } + @@ -20301,8 +20318,12 @@ namespace olc bool PixelGameEngine::Construct(const PGEConfig& cfg) { config = cfg; + + if (config.bRealWindow) + config.vPixelSize = { 1,1 }; + // Also assign the window level config since that is what the Host will see - Window::config = cfg; + Window::config = config; // Check for constructor sAppName, if not set use Config sAppName if (sAppName.empty())