METHOD(Label, recalcPositionWithText, void(entity, string))
ATTRIB(Label, isBold, float, 0)
ATTRIB(Label, text, string, string_null)
+ ATTRIB(Label, currentText, string, string_null)
ATTRIB(Label, fontSize, float, 8)
ATTRIB(Label, align, float, 0.5)
ATTRIB(Label, allowCut, float, 0)
ATTRIB(Label, realFontSize, vector, '0 0 0')
ATTRIB(Label, realOrigin, vector, '0 0 0')
ATTRIB(Label, alpha, float, 0.7)
- ATTRIB(Label, colorL, vector, '1 1 1')
+ ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
ATTRIB(Label, disabled, float, 0)
ATTRIB(Label, disabledAlpha, float, 0.3)
ATTRIB(Label, textEntity, entity, NULL)
void Label_setText(entity me, string txt)
{
me.text = txt;
- me.recalcPos = 1;
+ if(txt != me.currentText)
+ {
+ if(me.currentText)
+ strunzone(me.currentText);
+ me.currentText = strzone(txt);
+ me.recalcPos = 1;
+ }
}
void Label_recalcPositionWithText(entity me, string t)
{
me.realOrigin_x = me.keepspaceLeft;
if(!me.overrideCondenseFactor)
me.condenseFactor = spaceAvail / spaceUsed;
- dprint(sprintf(_("NOTE: label text %s too wide for label, condensed by factor %f\n"), t, me.condenseFactor));
+ dprintf("NOTE: label text %s too wide for label, condensed by factor %f\n", t, me.condenseFactor);
}
if(!me.overrideRealOrigin_y)
if(me.textEntity)
{
t = me.textEntity.toString(me.textEntity);
- me.recalcPos = 1;
+ if(t != me.currentText)
+ {
+ if(me.currentText)
+ strunzone(me.currentText);
+ me.currentText = strzone(t);
+ me.recalcPos = 1;
+ }
}
else
t = me.text;