10 if (txt != me.currentText)
12 strcpy(me.currentText, txt);
19 spaceAvail = 1 - me.keepspaceLeft - me.keepspaceRight;
26 if (spaceUsed <= spaceAvail)
28 if (!me.overrideRealOrigin_x) me.realOrigin_x = me.align * (spaceAvail - spaceUsed) + me.keepspaceLeft;
29 if (!me.overrideCondenseFactor) me.condenseFactor = 1;
31 else if (me.allowCut || me.allowWrap)
33 if (!me.overrideRealOrigin_x) me.realOrigin_x = me.keepspaceLeft;
34 if (!me.overrideCondenseFactor) me.condenseFactor = 1;
38 if (!me.overrideRealOrigin_x) me.realOrigin_x = me.keepspaceLeft;
39 if (!me.overrideCondenseFactor) me.condenseFactor = spaceAvail / spaceUsed;
40 LOG_TRACEF(
"NOTE: label text %s too wide for label, condensed by factor %f", t, me.condenseFactor);
43 if (!me.overrideRealOrigin_y)
51 fs.x *= me.condenseFactor;
60 else if (me.allowWrap)
78 me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize.y);
87 SUPER(
Label).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
90 me.realFontSize_y = absSize.y == 0 ? 0 : (me.fontSize / absSize.y);
91 me.realFontSize_x = absSize.x == 0 ? 0 : (me.fontSize / absSize.x);
92 if (me.marginLeft) me.keepspaceLeft = me.marginLeft * me.realFontSize.x;
93 if (me.marginRight) me.keepspaceRight = me.marginRight * me.realFontSize.x;
107 if (me.disabled)
draw_alpha *= me.disabledAlpha;
111 t = me.textEntity.toString(me.textEntity);
112 if (t != me.currentText)
114 strcpy(me.currentText, t);
123 if (me.recalcPos) me.recalcPositionWithText(me, t);
134 fs = me.realFontSize;
135 fs.x *= me.condenseFactor;
142 draw_Text(me.realOrigin,
draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight), me.allowColors, fs), fs, me.colorL, me.alpha, me.allowColors);
144 else if (me.allowWrap)
152 draw_Text(o, t, fs, me.colorL, me.alpha, me.allowColors);
153 o.y += me.realFontSize.y;
158 draw_Text(me.realOrigin, t, fs, me.colorL, me.alpha, me.allowColors);
#define draw_endBoldFont()
string Label_toString(entity me)
string getWrappedLine_remaining
void Label_draw(entity me)
#define draw_beginBoldFont()
void Label_recalcPositionWithText(entity me, string t)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void Label_configureLabel(entity me, string txt, float sz, float algn)
string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
void Label_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
void Label_setText(entity me, string txt)