mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Abort in RenderSoundNotification if no active notification
This commit is contained in:
parent
456c4ac79b
commit
bc430595eb
|
@ -38,6 +38,10 @@ void CNotifications::RenderSoundNotification()
|
||||||
const float ItemWidth = 20.f;
|
const float ItemWidth = 20.f;
|
||||||
const float DisplayTime = 1.5f; // includes FadeTime
|
const float DisplayTime = 1.5f; // includes FadeTime
|
||||||
const float FadeTime = 0.6f;
|
const float FadeTime = 0.6f;
|
||||||
|
const float RemainingDisplayTime = max(0.0f, m_SoundToggleTime + DisplayTime - Client()->LocalTime());
|
||||||
|
|
||||||
|
if(RemainingDisplayTime == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
Graphics()->MapScreen(0.0f, 0.0f, Width, Height);
|
Graphics()->MapScreen(0.0f, 0.0f, Width, Height);
|
||||||
|
|
||||||
|
@ -47,8 +51,7 @@ void CNotifications::RenderSoundNotification()
|
||||||
Area.w = ItemWidth;
|
Area.w = ItemWidth;
|
||||||
Area.h = ItemHeight;
|
Area.h = ItemHeight;
|
||||||
|
|
||||||
float Fade = max(0.0f, m_SoundToggleTime + DisplayTime - Client()->LocalTime());
|
const float Fade = min(1.0f, RemainingDisplayTime / FadeTime); // 0.0 ≤ Fade ≤ 1.0
|
||||||
Fade = min(1.0f, Fade / FadeTime); // 0.0 ≤ Fade ≤ 1.0
|
|
||||||
|
|
||||||
vec4 Color = (g_Config.m_SndEnable == 0) ? vec4(1.f/0xff*0xf9, 1.f/0xff*0x2b, 1.f/0xff*0x2b, 0.55f) : vec4(1.f/0xff*0x2b, 1.f/0xff*0xf9, 1.f/0xff*0x2b, 0.55f);
|
vec4 Color = (g_Config.m_SndEnable == 0) ? vec4(1.f/0xff*0xf9, 1.f/0xff*0x2b, 1.f/0xff*0x2b, 0.55f) : vec4(1.f/0xff*0x2b, 1.f/0xff*0xf9, 1.f/0xff*0x2b, 0.55f);
|
||||||
Color = mix(vec4(Color.r, Color.g, Color.b, 0.0f), Color, 0.8*Fade);
|
Color = mix(vec4(Color.r, Color.g, Color.b, 0.0f), Color, 0.8*Fade);
|
||||||
|
|
Loading…
Reference in a new issue