diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5bcf02ff..daf0eade 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 5 #define VERSION_PATCH 1 -#define VERSION_BUILD 8082 +#define VERSION_BUILD 8085 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index f3197d98..a3bda95d 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -4594,7 +4594,24 @@ namespace olc { bHasMouseFocus = state; } void PixelGameEngine::olc_UpdateKeyFocus(bool state) - { bHasInputFocus = state; } + { + bHasInputFocus = state; + + if(!state){ //Drop all key and mouse inputs as we have lost input focus. + // Compare hardware input states from previous frame + auto ScanHardware = [&](HWButton* pKeys, bool* pStateOld, bool* pStateNew, uint32_t nKeyCount) + { + for (uint32_t i = 0; i < nKeyCount; i++) + { + if(pKeys==pKeyboardState)olc_UpdateKeyState(i,false); + else if(pKeys==pMouseState)olc_UpdateMouseState(i,false); + } + }; + + ScanHardware(pKeyboardState, pKeyOldState, pKeyNewState, 256); + ScanHardware(pMouseState, pMouseOldState, pMouseNewState, nMouseButtons); + } + } void PixelGameEngine::olc_DropFiles(int32_t x, int32_t y, const std::vector& vFiles) { diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 93e35234..4aa292d2 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ