nuclide/src/vgui/ui_label.cpp
Marco Hladik 324fadd668 Spring cleaning. Prepare for summer! Fixed lots of bugs too:
v_camroll is now working again.
Counter-Strike is finally getting somewhere again.
Counter-Strike has pseudo spray-patterns now! They're all the same.
func_button now can be programmed to use Sound-Shaders.
The menu handles the vid_conautoscale command autonomously. Set r_autoscale
to 0 if you don't like it.
The menu has an updater, requires a not-yet-pushed build of FTE.
Don't use it yet.
Moved a lot of globals into pSeat's structs to fix splitscreen with them.
Made explosion decals be handled client-side!
Added trigger_look, env_sun and light_environment entities.
2020-04-12 15:50:42 +02:00

61 lines
1.8 KiB
C++

/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
class CUILabel:CUIWidget
{
vector m_vecSize;
string m_strTitle;
void(void) CUILabel;
virtual void(void) Draw;
virtual void(vector) SetSize;
virtual void(string) SetTitle;
virtual void(float, float, float, float) Input;
};
void CUILabel::CUILabel(void)
{
m_vecSize = [96,16];
m_iFlags = BUTTON_VISIBLE;
}
void CUILabel::SetSize (vector vecSize)
{
m_vecSize = vecSize;
}
void CUILabel::SetTitle (string strName)
{
#ifndef CLASSIC_VGUI
m_strTitle = strName;
#else
m_strTitle = sprintf("%s%s", Font_RGBtoHex(UI_MAINCOLOR), strName);
#endif
drawfont = g_fntDefault.iID;
/* hack, add 2 just to make sure it doesn't immediately wrap. bug
* in engines' textfield thing in combo with ttf. */
SetSize([2 + stringwidth(m_strTitle, TRUE, [g_fntDefault.iScale, g_fntDefault.iScale]), 16]);
}
void CUILabel::Draw(void)
{
if (m_strTitle) {
Font_DrawField(m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_strTitle, g_fntDefault, 0);
}
}
void CUILabel::Input (float flEVType, float flKey, float flChar, float flDevID)
{
}