Fix not working in webclient

This commit is contained in:
UnknownShadow200 2022-01-01 17:27:02 +11:00
parent 7b8469573f
commit cafd511d75
3 changed files with 12 additions and 4 deletions

View File

@ -275,12 +275,17 @@ static void HandleLowVRAMDetected(void* obj) {
static void HandleInactiveChanged(void* obj) {
if (WindowInfo.Inactive) {
Chat_AddRaw("&cHIDE");
Chat_AddRaw(LOWPERF_ENTER_MESSAGE);
Gfx_SetFpsLimit(false, 1000 / 1.0f);
} else {
Chat_AddRaw("&aSHOW");
Chat_AddRaw(LOWPERF_EXIT_MESSAGE);
Game_SetFpsLimit(Game_FpsLimit);
}
#ifdef CC_BUILD_WEB
extern void emscripten_resume_main_loop(void);
emscripten_resume_main_loop();
#endif
}
static void Game_WarnFunc(const cc_string* msg) {

View File

@ -60,6 +60,9 @@ extern GfxResourceID Gfx_quadVb, Gfx_texVb;
/* Texture should allow updating via Gfx_UpdateTexture */
#define TEXTURE_FLAG_DYNAMIC 0x02
#define LOWPERF_ENTER_MESSAGE "&eEntering reduced performance mode (game minimised or hidden)"
#define LOWPERF_EXIT_MESSAGE "&eExited reduced performance mode"
void Gfx_RecreateDynamicVb(GfxResourceID* vb, VertexFormat fmt, int maxVertices);
void Gfx_RecreateTexture(GfxResourceID* tex, struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps);
void* Gfx_RecreateAndLockVb(GfxResourceID* vb, VertexFormat fmt, int count);

View File

@ -116,13 +116,13 @@ static void TickReducedPerformance(void) {
if (reducedPerformance) return;
reducedPerformance = true;
Chat_AddRaw("&eEntering reduced performance mode (game minimised or hidden)");
Chat_AddRaw(LOWPERF_ENTER_MESSAGE);
}
static void EndReducedPerformance(void) {
if (!reducedPerformance) return;
reducedPerformance = false;
Chat_AddRaw("&eExited reduced performance mode");
Chat_AddRaw(LOWPERF_EXIT_MESSAGE);
}