diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/hud_basetimer.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/hud_basetimer.cpp')
| -rw-r--r-- | mp/src/game/client/hud_basetimer.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/mp/src/game/client/hud_basetimer.cpp b/mp/src/game/client/hud_basetimer.cpp index 2cb62cdb..d666268c 100644 --- a/mp/src/game/client/hud_basetimer.cpp +++ b/mp/src/game/client/hud_basetimer.cpp @@ -1,84 +1,84 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Draws a timer in the format "Minutes:Seconds"
-// Seconds are padded with zeros
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "hudelement.h"
-#include <vgui_controls/Panel.h>
-#include <vgui/ISurface.h>
-#include "hud_basetimer.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-using namespace vgui;
-
-CHudBaseTimer::CHudBaseTimer(vgui::Panel *parent, const char *name) : BaseClass(parent, name)
-{
- m_iMinutes = 0;
- m_iSeconds = 0;
- SetLabelText(L"");
-}
-
-void CHudBaseTimer::SetMinutes(int minutes)
-{
- m_iMinutes = minutes;
-}
-
-void CHudBaseTimer::SetSeconds(int seconds)
-{
- m_iSeconds = seconds;
-}
-
-void CHudBaseTimer::PaintTime(HFont font, int xpos, int ypos, int mins, int secs)
-{
- surface()->DrawSetTextFont(font);
- wchar_t unicode[6];
- V_snwprintf(unicode, ARRAYSIZE(unicode), L"%d:%.2d", mins, secs);
-
- surface()->DrawSetTextPos(xpos, ypos);
- surface()->DrawUnicodeString( unicode );
-}
-
-void CHudBaseTimer::Paint()
-{
- float alpha = m_flAlphaOverride / 255;
- Color fgColor = GetFgColor();
- fgColor[3] *= alpha;
- SetFgColor( fgColor );
-
- surface()->DrawSetTextColor(GetFgColor());
- PaintTime( m_hNumberFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds );
-
- // draw the overbright blur
- for (float fl = m_flBlur; fl > 0.0f; fl -= 1.0f)
- {
- if (fl >= 1.0f)
- {
- PaintTime(m_hNumberGlowFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds);
- }
- else
- {
- // draw a percentage of the last one
- Color col = GetFgColor();
- col[3] *= fl;
- surface()->DrawSetTextColor(col);
- PaintTime(m_hNumberGlowFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds);
- }
- }
-
- BaseClass::PaintLabel();
-}
-
-void CHudBaseTimer::SetToPrimaryColor()
-{
- SetFgColor(m_TextColor);
-}
-
-void CHudBaseTimer::SetToSecondaryColor()
-{
- SetFgColor(m_FlashColor);
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Draws a timer in the format "Minutes:Seconds" +// Seconds are padded with zeros +// +//=============================================================================// + +#include "cbase.h" +#include "hudelement.h" +#include <vgui_controls/Panel.h> +#include <vgui/ISurface.h> +#include "hud_basetimer.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +using namespace vgui; + +CHudBaseTimer::CHudBaseTimer(vgui::Panel *parent, const char *name) : BaseClass(parent, name) +{ + m_iMinutes = 0; + m_iSeconds = 0; + SetLabelText(L""); +} + +void CHudBaseTimer::SetMinutes(int minutes) +{ + m_iMinutes = minutes; +} + +void CHudBaseTimer::SetSeconds(int seconds) +{ + m_iSeconds = seconds; +} + +void CHudBaseTimer::PaintTime(HFont font, int xpos, int ypos, int mins, int secs) +{ + surface()->DrawSetTextFont(font); + wchar_t unicode[6]; + V_snwprintf(unicode, ARRAYSIZE(unicode), L"%d:%.2d", mins, secs); + + surface()->DrawSetTextPos(xpos, ypos); + surface()->DrawUnicodeString( unicode ); +} + +void CHudBaseTimer::Paint() +{ + float alpha = m_flAlphaOverride / 255; + Color fgColor = GetFgColor(); + fgColor[3] *= alpha; + SetFgColor( fgColor ); + + surface()->DrawSetTextColor(GetFgColor()); + PaintTime( m_hNumberFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds ); + + // draw the overbright blur + for (float fl = m_flBlur; fl > 0.0f; fl -= 1.0f) + { + if (fl >= 1.0f) + { + PaintTime(m_hNumberGlowFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds); + } + else + { + // draw a percentage of the last one + Color col = GetFgColor(); + col[3] *= fl; + surface()->DrawSetTextColor(col); + PaintTime(m_hNumberGlowFont, digit_xpos, digit_ypos, m_iMinutes, m_iSeconds); + } + } + + BaseClass::PaintLabel(); +} + +void CHudBaseTimer::SetToPrimaryColor() +{ + SetFgColor(m_TextColor); +} + +void CHudBaseTimer::SetToSecondaryColor() +{ + SetFgColor(m_FlashColor); +} |