mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Exiting reduced performance message now shown in top left for around a second instead of in chat
This commit is contained in:
parent
5177ff9d13
commit
b24b25c094
@ -307,10 +307,13 @@ static void HandleInactiveChanged(void* obj) {
|
||||
if (Window_Main.Inactive) {
|
||||
Chat_AddOf(&Gfx_LowPerfMessage, MSG_TYPE_EXTRASTATUS_2);
|
||||
Gfx_SetFpsLimit(false, 1000 / 1.0f);
|
||||
Gfx.ReducedPerfMode = true;
|
||||
} else {
|
||||
Chat_AddOf(&String_Empty, MSG_TYPE_EXTRASTATUS_2);
|
||||
Game_SetFpsLimit(Game_FpsLimit);
|
||||
Chat_AddRaw(LOWPERF_EXIT_MESSAGE);
|
||||
|
||||
Gfx.ReducedPerfMode = false;
|
||||
Gfx.ReducedPerfModeCooldown = 2;
|
||||
}
|
||||
|
||||
#ifdef CC_BUILD_WEB
|
||||
|
@ -64,6 +64,8 @@ CC_VAR extern struct _GfxData {
|
||||
/* Minimum dimensions in pixels that a texture must be */
|
||||
/* NOTE: Most graphics backends do not use this */
|
||||
int MinTexWidth, MinTexHeight;
|
||||
cc_bool ReducedPerfMode;
|
||||
cc_uint8 ReducedPerfModeCooldown;
|
||||
} Gfx;
|
||||
|
||||
extern GfxResourceID Gfx_defaultIb;
|
||||
@ -87,8 +89,6 @@ typedef enum GfxBuffers_ {
|
||||
/* Texture can fallback to 16 bpp when necessary (most backends don't do this) */
|
||||
#define TEXTURE_FLAG_LOWRES 0x08
|
||||
|
||||
#define LOWPERF_EXIT_MESSAGE "&eExited reduced performance mode"
|
||||
|
||||
void Gfx_RecreateTexture(GfxResourceID* tex, struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps);
|
||||
void* Gfx_RecreateAndLockVb(GfxResourceID* vb, VertexFormat fmt, int count);
|
||||
|
||||
|
@ -95,7 +95,10 @@ static void HUDScreen_RemakeLine1(struct HUDScreen* s) {
|
||||
if (!Gui.ShowFPS && s->line1.tex.ID) return;
|
||||
fps = s->accumulator == 0 ? 1 : (int)(s->frames / s->accumulator);
|
||||
|
||||
if (fps == 0) {
|
||||
if (Gfx.ReducedPerfMode || (Gfx.ReducedPerfModeCooldown > 0)) {
|
||||
String_AppendConst(&status, "(low perf mode), ");
|
||||
Gfx.ReducedPerfModeCooldown--;
|
||||
} else if (fps == 0) {
|
||||
/* Running at less than 1 FPS.. */
|
||||
real_fps = s->frames / s->accumulator;
|
||||
String_Format1(&status, "%f1 fps, ", &real_fps);
|
||||
|
@ -173,20 +173,20 @@ void Gfx_RecreateContext(void) {
|
||||
Event_RaiseVoid(&GfxEvents.ContextRecreated);
|
||||
}
|
||||
|
||||
cc_bool reducedPerformance;
|
||||
static CC_INLINE void TickReducedPerformance(void) {
|
||||
Thread_Sleep(100); /* 10 FPS */
|
||||
|
||||
if (reducedPerformance) return;
|
||||
reducedPerformance = true;
|
||||
if (Gfx.ReducedPerfMode) return;
|
||||
Gfx.ReducedPerfMode = true;
|
||||
Chat_AddOf(&Gfx_LowPerfMessage, MSG_TYPE_EXTRASTATUS_2);
|
||||
}
|
||||
|
||||
static CC_INLINE void EndReducedPerformance(void) {
|
||||
if (!reducedPerformance) return;
|
||||
reducedPerformance = false;
|
||||
Chat_AddOf(&String_Empty, MSG_TYPE_EXTRASTATUS_2);
|
||||
Chat_AddRaw(LOWPERF_EXIT_MESSAGE);
|
||||
if (!Gfx.ReducedPerfMode) return;
|
||||
|
||||
Gfx.ReducedPerfModeCooldown = 2;
|
||||
Gfx.ReducedPerfMode = false;
|
||||
Chat_AddOf(&String_Empty, MSG_TYPE_EXTRASTATUS_2);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user