When the game loses focus, the game will autopause during exploration. Release Build 8879.

mac-build
sigonasr2 8 months ago
parent 77e2a654f4
commit 3c65db545d
  1. 6
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 1
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 13
      Adventures in Lestoria/Minimap.cpp
  4. 2
      Adventures in Lestoria/Version.h
  5. 3
      Adventures in Lestoria/olcPixelGameEngine.h
  6. BIN
      x64/Release/Adventures in Lestoria.exe

@ -4074,4 +4074,10 @@ void AiL::ComputeModeColors(TilesetData&tileset){
#pragma endregion #pragma endregion
} }
} }
}
void AiL::OnWindowLoseFocus()const{
if(!Menu::IsMenuOpen()&&GameState::STATE==GameState::states[States::GAME_RUN]){
Menu::OpenMenu(MenuType::PAUSE);
}
} }

@ -205,6 +205,7 @@ public:
bool OnUserCreate() override; bool OnUserCreate() override;
bool OnUserUpdate(float fElapsedTime) override; bool OnUserUpdate(float fElapsedTime) override;
bool OnUserDestroy() override; bool OnUserDestroy() override;
void OnWindowLoseFocus()const override final;
void GetAnyKeyPress(Key key)override final; void GetAnyKeyPress(Key key)override final;
void GetAnyKeyRelease(Key key)override final; void GetAnyKeyRelease(Key key)override final;
void GetAnyMousePress(int32_t mouseButton)override final; void GetAnyMousePress(int32_t mouseButton)override final;

@ -136,6 +136,19 @@ void Minimap::Reset(){
} }
} }
} }
if(game->GetZones().count("EndZone")){
for(const ZoneData&zone:game->GetZones().at("EndZone")){
vf2d ringPos=zone.zone.pos/game->GetCurrentMapData().TileSize;
vf2d ringSize=zone.zone.size/game->GetCurrentMapData().TileSize;
for(int y=0;y<=ringSize.y;y++){
for(int x=0;x<=ringSize.x;x++){
minimap.Sprite()->SetPixel(ringPos+vi2d{x,y},GREEN);
}
}
}
}
game->SetDrawTarget(nullptr); game->SetDrawTarget(nullptr);
minimap.Decal()->Update(); minimap.Decal()->Update();

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 1 #define VERSION_MINOR 1
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 8875 #define VERSION_BUILD 8879
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1021,6 +1021,7 @@ namespace olc
// Called when a console command is executed // Called when a console command is executed
virtual bool OnConsoleCommand(const std::string& sCommand); virtual bool OnConsoleCommand(const std::string& sCommand);
virtual void OnRequestCompleted(const std::string_view receivedData)const; virtual void OnRequestCompleted(const std::string_view receivedData)const;
virtual void OnWindowLoseFocus()const;
virtual olc::rcode SendRequest(std::string_view url,std::string_view data); virtual olc::rcode SendRequest(std::string_view url,std::string_view data);
@ -4619,6 +4620,7 @@ namespace olc
bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; } bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; }
void PixelGameEngine::OnRequestCompleted(const std::string_view receivedData)const{} void PixelGameEngine::OnRequestCompleted(const std::string_view receivedData)const{}
void PixelGameEngine::OnWindowLoseFocus()const{}
olc::rcode PixelGameEngine::SendRequest(std::string_view url,std::string_view data){platform->SendRequest(url,data);return olc::rcode::OK;}; olc::rcode PixelGameEngine::SendRequest(std::string_view url,std::string_view data){platform->SendRequest(url,data);return olc::rcode::OK;};
@ -4698,6 +4700,7 @@ namespace olc
olc_UpdateKeyState(i,false); olc_UpdateKeyState(i,false);
} }
} }
if(!state)OnWindowLoseFocus();
bHasInputFocus = state; bHasInputFocus = state;
} }

Loading…
Cancel
Save