Xonotic
draw.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define draw_beginBoldFont()   drawfont = FONT_USER + 3
 
#define draw_endBoldFont()   drawfont = FONT_USER
 
#define draw_fontscale   drawfontscale
 

Functions

vector boxToGlobal (vector v, vector shift, vector scale)
 
vector boxToGlobalSize (vector v, vector scale)
 
void draw_BorderPicture (vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
 
void draw_ButtonPicture (vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
 
void draw_CenterText (vector origin, string text, vector size, vector color, float alpha, float allowColorCodes)
 
void draw_ClearClip ()
 
float draw_CondensedFontFactor (string theText, float ICanHasKallerz, vector SizeThxBye, float maxWidth)
 
void draw_drawMousePointer (vector where)
 
void draw_Fill (vector theOrigin, vector theSize, vector theColor, float theAlpha)
 
void draw_Picture (vector origin, string pic, vector size, vector color, float alpha)
 
vector draw_PictureSize (string pic)
 
string draw_PreloadPicture (string pic)
 
string draw_PreloadPictureWithFlags (string pic, float f)
 
void draw_reset (float cw, float ch, float ox, float oy)
 
void draw_SetClip ()
 
void draw_SetClipRect (vector theOrigin, vector theScale)
 
void draw_setMousePointer (string pic, vector theSize, vector theOffset)
 
void draw_Text (vector origin, string text, vector size, vector color, float alpha, float allowColorCodes)
 
float draw_TextLengthUpToWidth (string text, float maxWidth, float allowColorCodes, vector size)
 
string draw_TextShortenToWidth (string text, float maxWidth, float allowColorCodes, vector size)
 
float draw_TextWidth (string text, float allowColorCodes, vector size)
 
float draw_TextWidth_WithColors (string s, vector size)
 
float draw_TextWidth_WithoutColors (string s, vector size)
 
void draw_VertButtonPicture (vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
 
vector globalToBox (vector v, vector shift, vector scale)
 
vector globalToBoxSize (vector v, vector scale)
 

Variables

float draw_alpha
 
vector draw_scale
 
vector draw_shift
 
vector drawfontscale
 

Macro Definition Documentation

◆ draw_beginBoldFont

#define draw_beginBoldFont ( )    drawfont = FONT_USER + 3

Definition at line 12 of file draw.qh.

◆ draw_endBoldFont

#define draw_endBoldFont ( )    drawfont = FONT_USER

Definition at line 13 of file draw.qh.

◆ draw_fontscale

Function Documentation

◆ boxToGlobal()

vector boxToGlobal ( vector  v,
vector  shift,
vector  scale 
)

Definition at line 45 of file draw.qc.

References v.

Referenced by BorderImage_recalcPositionWithText(), Container_enterLieSubitem(), Container_resizeNotifyLie(), DemoConfirm_ListClick_Check_Gamestatus(), draw_BorderPicture(), draw_ButtonPicture(), draw_drawMousePointer(), draw_Fill(), draw_Picture(), draw_SetClipRect(), draw_Text(), draw_VertButtonPicture(), ListBox_draw(), ServerList_Info_Click(), XonoticServerList_keyDown(), and XonoticServerList_positionSortButton().

46 {
47  v.x *= theScale.x;
48  v.y *= theScale.y;
49  v += theOrigin;
50  return v;
51 }
vector v
Definition: ent_cs.qc:116
+ Here is the caller graph for this function:

◆ boxToGlobalSize()

vector boxToGlobalSize ( vector  v,
vector  scale 
)

Definition at line 53 of file draw.qc.

References v.

Referenced by BorderImage_draw(), BorderImage_recalcPositionWithText(), Container_enterLieSubitem(), Container_resizeNotifyLie(), DemoConfirm_ListClick_Check_Gamestatus(), draw_BorderPicture(), draw_ButtonPicture(), draw_Fill(), draw_Picture(), draw_SetClipRect(), draw_Text(), draw_TextWidth(), draw_VertButtonPicture(), ListBox_draw(), ServerList_Info_Click(), XonoticServerList_keyDown(), and XonoticServerList_positionSortButton().

54 {
55  v.x *= theScale.x;
56  v.y *= theScale.y;
57  return v;
58 }
vector v
Definition: ent_cs.qc:116
+ Here is the caller graph for this function:

◆ draw_BorderPicture()

void draw_BorderPicture ( vector  theOrigin,
string  pic,
vector  theSize,
vector  theColor,
float  theAlpha,
vector  theBorderSize 
)

Definition at line 169 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_scale, draw_shift, draw_UseSkinFor(), drawsubpic(), eX, eY, height, and vector().

Referenced by BorderImage_draw(), m_tooltip(), and minigame_hud_simpleboard().

170 {
171  vector dX, dY;
172  vector width, height;
173  vector bW, bH;
174  pic = draw_UseSkinFor(pic);
175  theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
176  theSize = boxToGlobalSize(theSize, draw_scale);
177  theBorderSize = boxToGlobalSize(theBorderSize, draw_scale);
178  theAlpha *= draw_alpha;
179  width = eX * theSize.x;
180  height = eY * theSize.y;
181  // zero size? bail out, we cannot handle this
182  if(theSize.x <= 0 || theSize.y <= 0)
183  return;
184  if(theBorderSize.x <= 0) // no x border
185  {
186  if(theBorderSize.y <= 0)
187  {
188  drawsubpic(theOrigin, width + height, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
189  }
190  else if(theSize.y <= theBorderSize.y * 2)
191  {
192  // not high enough... draw just top and bottom then
193  bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
194  drawsubpic(theOrigin, width + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
195  drawsubpic(theOrigin + height * 0.5, width + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
196  }
197  else
198  {
199  dY = theBorderSize.y * eY;
200  drawsubpic(theOrigin, width + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
201  drawsubpic(theOrigin + dY, width + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
202  drawsubpic(theOrigin + height - dY, width + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
203  }
204  }
205  else if(theSize.x <= theBorderSize.x * 2)
206  {
207  // not wide enough... draw just left and right then
208  bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
209  if(theBorderSize.y <= 0)
210  {
211  drawsubpic(theOrigin, width * 0.5 + height, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
212  drawsubpic(theOrigin + width * 0.5, width * 0.5 + height, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
213  }
214  else if(theSize.y <= theBorderSize.y * 2)
215  {
216  // not high enough... draw just corners
217  bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
218  drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
219  drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
220  drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
221  drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
222  }
223  else
224  {
225  dY = theBorderSize.y * eY;
226  drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
227  drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
228  drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
229  drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
230  drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
231  drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5 + dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
232  }
233  }
234  else
235  {
236  if(theBorderSize.y <= 0)
237  {
238  dX = theBorderSize.x * eX;
239  drawsubpic(theOrigin, dX + height, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
240  drawsubpic(theOrigin + dX, width - 2 * dX + height, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
241  drawsubpic(theOrigin + width - dX, dX + height, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
242  }
243  else if(theSize.y <= theBorderSize.y * 2)
244  {
245  // not high enough... draw just top and bottom then
246  bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
247  dX = theBorderSize.x * eX;
248  drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
249  drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
250  drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
251  drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
252  drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
253  drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
254  }
255  else
256  {
257  dX = theBorderSize.x * eX;
258  dY = theBorderSize.y * eY;
259  drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
260  drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
261  drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
262  drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
263  drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
264  drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
265  drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
266  drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
267  drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
268  }
269  }
270 }
const vector eY
Definition: vector.qh:45
string draw_UseSkinFor(string pic)
Definition: util.qc:206
float height
Definition: jumppads.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_ButtonPicture()

void draw_ButtonPicture ( vector  theOrigin,
string  pic,
vector  theSize,
vector  theColor,
float  theAlpha 
)

Definition at line 97 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_scale, draw_shift, draw_UseSkinFor(), drawsubpic(), eX, eY, height, and vector().

Referenced by Button_draw(), InputBox_draw(), and Slider_draw().

98 {
99  vector square;
100  vector width, height;
101  vector bW;
102  pic = draw_UseSkinFor(pic);
103  theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
104  theSize = boxToGlobalSize(theSize, draw_scale);
105  theAlpha *= draw_alpha;
106  width = eX * theSize.x;
107  height = eY * theSize.y;
108  if(theSize.x <= theSize.y * 2)
109  {
110  // button not wide enough
111  // draw just left and right part then
112  square = eX * theSize.x * 0.5;
113  bW = eX * (0.25 * theSize.x / (theSize.y * 2));
114  drawsubpic(theOrigin, square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, 0);
115  drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, 0);
116  }
117  else
118  {
119  square = eX * theSize.y;
120  drawsubpic(theOrigin, height + square, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, 0);
121  drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0.25 0 0', '0.5 1 0', theColor, theAlpha, 0);
122  drawsubpic(theOrigin + width - square, height + square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0);
123  }
124 }
const vector eY
Definition: vector.qh:45
string draw_UseSkinFor(string pic)
Definition: util.qc:206
float height
Definition: jumppads.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_CenterText()

void draw_CenterText ( vector  origin,
string  text,
vector  size,
vector  color,
float  alpha,
float  allowColorCodes 
)

Definition at line 287 of file draw.qc.

References draw_Text(), draw_TextWidth(), and eX.

Referenced by preMenuInit(), XonoticCharmap_cellDraw(), XonoticCreditsList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticPlayerModelSelector_draw(), XonoticPlayList_drawListBoxItem(), XonoticScreenshotImage_draw(), and XonoticSoundList_drawListBoxItem().

288 {
289  //dprint(strcat("orig = ", vtos(theOrigin) ," tx = ", ftos(draw_TextWidth(theText, ICanHasKallerz, theSize)), "\n"));
290  draw_Text(theOrigin - eX * 0.5 * draw_TextWidth(theText, ICanHasKallerz, theSize), theText, theSize, theColor, theAlpha, ICanHasKallerz);
291 }
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_ClearClip()

void draw_ClearClip ( )

Definition at line 351 of file draw.qc.

References ClipFrame::clip_scale, ClipFrame::clip_shift, drawresetcliparea(), drawsetcliparea(), entity(), IL_EMPTY, IL_PEEK, IL_REMOVE(), and LOG_FATAL.

Referenced by Image_draw(), InputBox_draw(), and ListBox_draw().

352 {
353  if (IL_EMPTY(draw_clip)) {
354  LOG_FATAL("Not clipping, can't clear it then");
355  }
356  entity currentSettings = IL_PEEK(draw_clip);
357  IL_REMOVE(draw_clip, currentSettings);
358  delete(currentSettings);
361  if (e) {
363  }
364 }
vector clip_shift
Definition: draw.qc:318
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
entity() spawn
#define IL_PEEK(this)
#define IL_EMPTY(this)
#define LOG_FATAL(...)
Definition: log.qh:58
vector clip_scale
Definition: draw.qc:319
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_CondensedFontFactor()

float draw_CondensedFontFactor ( string  theText,
float  ICanHasKallerz,
vector  SizeThxBye,
float  maxWidth 
)

Definition at line 305 of file draw.qc.

References draw_TextWidth().

Referenced by XonoticLanguageList_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

306 {
307  float w = draw_TextWidth(theText, ICanHasKallerz, SizeThxBye);
308  if (w > maxWidth) {
309  //dprintf("NOTE: label text %s too wide for label, condensed by factor %f\n", theText, maxWidth / w);
310  return maxWidth / w;
311  }
312  return 1.0;
313 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_drawMousePointer()

void draw_drawMousePointer ( vector  where)

Definition at line 16 of file draw.qc.

References boxToGlobal(), draw_alpha, draw_mousepointer, draw_mousepointer_offset, draw_mousepointer_size, draw_scale, draw_shift, and drawpic().

Referenced by m_draw().

17 {
19 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_Fill()

void draw_Fill ( vector  theOrigin,
vector  theSize,
vector  theColor,
float  theAlpha 
)

Definition at line 86 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_scale, draw_shift, and drawfill().

Referenced by InputBox_draw(), ListBox_draw(), m_draw(), XonoticCampaignList_drawListBoxItem(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticGametypeList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPicker_draw(), XonoticPlayList_drawListBoxItem(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), XonoticStatsList_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

87 {
88  drawfill(boxToGlobal(theOrigin, draw_shift, draw_scale), boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
89 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_Picture()

void draw_Picture ( vector  origin,
string  pic,
vector  size,
vector  color,
float  alpha 
)

Definition at line 72 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_scale, draw_shift, draw_UseSkinFor(), and drawpic().

Referenced by Button_draw(), draw_Picture_Aligned(), Image_draw(), InputBox_draw(), Slider_draw(), XonoticCampaignList_drawListBoxItem(), XonoticColorpicker_draw(), XonoticColorpickerString_draw(), XonoticCrosshairPicker_cellDraw(), XonoticCrosshairPreview_draw(), XonoticGametypeList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), and XonoticSkinList_drawListBoxItem().

73 {
74  if(theSize.x == 0 || theSize.y <= 0) // no default sizing please
75  return;
76  pic = draw_UseSkinFor(pic);
77  drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
78 }
string draw_UseSkinFor(string pic)
Definition: util.qc:206
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_PictureSize()

vector draw_PictureSize ( string  pic)

Definition at line 80 of file draw.qc.

References draw_UseSkinFor(), and drawgetimagesize().

Referenced by draw_Picture_Aligned(), Image_updateAspect(), XonoticCampaignList_drawListBoxItem(), XonoticColorpickerString_draw(), XonoticCrosshairPicker_cellDraw(), XonoticCrosshairPreview_draw(), XonoticMapInfoDialog_loadMapInfo(), XonoticMapList_drawListBoxItem(), XonoticPlayerModelSelector_go(), and XonoticServerList_drawListBoxItem().

81 {
82  pic = draw_UseSkinFor(pic);
83  return drawgetimagesize(pic);
84 }
vector drawgetimagesize(string pic)
string draw_UseSkinFor(string pic)
Definition: util.qc:206
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_PreloadPicture()

string draw_PreloadPicture ( string  pic)

Definition at line 60 of file draw.qc.

References draw_UseSkinFor(), and precache_pic().

Referenced by XonoticMapList_refilter().

61 {
62  pic = draw_UseSkinFor(pic);
63  return precache_pic(pic);
64 }
string draw_UseSkinFor(string pic)
Definition: util.qc:206
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_PreloadPictureWithFlags()

string draw_PreloadPictureWithFlags ( string  pic,
float  f 
)

Definition at line 66 of file draw.qc.

References draw_UseSkinFor(), and precache_pic().

Referenced by XonoticGametypeList_configureXonoticGametypeList().

67 {
68  pic = draw_UseSkinFor(pic);
69  return precache_pic(pic, f);
70 }
string draw_UseSkinFor(string pic)
Definition: util.qc:206
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_reset()

void draw_reset ( float  cw,
float  ch,
float  ox,
float  oy 
)

Definition at line 21 of file draw.qc.

References draw_alpha, draw_endBoldFont, draw_fontscale, draw_scale, and draw_shift.

Referenced by draw_reset_cropped(), and draw_reset_full().

22 {
23  draw_shift = '1 0 0' * ox + '0 1 0' * oy;
24  draw_scale = '1 0 0' * cw + '0 1 0' * ch;
25  draw_alpha = 1;
26  draw_fontscale = '1 1 0';
28 }
#define draw_endBoldFont()
Definition: draw.qh:5
+ Here is the caller graph for this function:

◆ draw_SetClip()

void draw_SetClip ( )

Definition at line 338 of file draw.qc.

References _draw_SetClip(), draw_scale, and draw_shift.

Referenced by Image_draw(), and ListBox_draw().

339 {
341 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_SetClipRect()

void draw_SetClipRect ( vector  theOrigin,
vector  theScale 
)

Definition at line 343 of file draw.qc.

References _draw_SetClip(), boxToGlobal(), boxToGlobalSize(), draw_scale, and draw_shift.

Referenced by InputBox_draw().

344 {
346  boxToGlobal(theOrigin, draw_shift, draw_scale),
347  boxToGlobalSize(theScale, draw_scale)
348  );
349 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_setMousePointer()

void draw_setMousePointer ( string  pic,
vector  theSize,
vector  theOffset 
)

Definition at line 9 of file draw.qc.

References draw_mousepointer, draw_mousepointer_offset, draw_mousepointer_size, draw_UseSkinFor(), eX, eY, and strzone().

Referenced by m_init_delayed().

10 {
12  draw_mousepointer_size = theSize;
13  draw_mousepointer_offset = eX * (theOffset.x * theSize.x) + eY * (theOffset.y * theSize.y);
14 }
const vector eY
Definition: vector.qh:45
string draw_UseSkinFor(string pic)
Definition: util.qc:206
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_Text()

void draw_Text ( vector  origin,
string  text,
vector  size,
vector  color,
float  alpha,
float  allowColorCodes 
)

Definition at line 271 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_fontscale, draw_scale, draw_shift, drawcolorcodedstring(), drawstring(), globalToBoxSize(), and LOG_TRACE.

Referenced by draw_CenterText(), InputBox_draw(), Label_draw(), ListBox_drawListBoxItem(), m_tooltip(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPlayList_drawListBoxItem(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticScreenshotImage_draw(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), XonoticStatsList_drawListBoxItem(), XonoticTextBox_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

272 {
273  if(theSize.x <= 0 || theSize.y <= 0) {
274  LOG_TRACE("Drawing zero size text?");
275  return;
276  }
277 
278  //float wi;
279  //wi = draw_TextWidth(theText, ICanHasKallerz, theSize);
280  //draw_Fill(theOrigin, '1 0 0' * wi + '0 1 0' * theSize_y, '1 0 0', 0.3);
281 
282  if(ICanHasKallerz)
284  else
285  drawstring(boxToGlobal(theOrigin, draw_shift, draw_scale), theText, globalToBoxSize(boxToGlobalSize(theSize, draw_scale), draw_fontscale), theColor, theAlpha * draw_alpha, 0);
286 }
#define LOG_TRACE(...)
Definition: log.qh:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_TextLengthUpToWidth()

float draw_TextLengthUpToWidth ( string  text,
float  maxWidth,
float  allowColorCodes,
vector  size 
)

Definition at line 390 of file draw.qc.

References draw_TextWidth_WithColors(), draw_TextWidth_WithoutColors(), and textLengthUpToWidth().

Referenced by InputBox_mouseDrag().

391 {
392  if(allowColorCodes)
393  return textLengthUpToWidth(theText, maxWidth, theFontSize, draw_TextWidth_WithColors);
394  else
395  return textLengthUpToWidth(theText, maxWidth, theFontSize, draw_TextWidth_WithoutColors);
396 }
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
Definition: util.qc:773
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_TextShortenToWidth()

string draw_TextShortenToWidth ( string  text,
float  maxWidth,
float  allowColorCodes,
vector  size 
)

Definition at line 366 of file draw.qc.

References draw_TextWidth_WithColors(), draw_TextWidth_WithoutColors(), and textShortenToWidth().

Referenced by Label_draw(), XonoticCampaignList_drawListBoxItem(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPlayList_drawListBoxItem(), XonoticRegisteredSettingsList_getTooltip_cb(), XonoticScreenshotList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), and XonoticStatsList_drawListBoxItem().

367 {
368  /*
369  if(draw_TextWidth(theText, ICanHasKallerz, SizeThxBye) <= maxWidth)
370  return theText;
371  else
372  return strcat(substring(theText, 0, draw_TextLengthUpToWidth(theText, maxWidth - draw_TextWidth("...", ICanHasKallerz, SizeThxBye), ICanHasKallerz, SizeThxBye)), "...");
373  */
374  if(ICanHasKallerz)
375  return textShortenToWidth(theText, maxWidth, SizeThxBye, draw_TextWidth_WithColors);
376  else
377  return textShortenToWidth(theText, maxWidth, SizeThxBye, draw_TextWidth_WithoutColors);
378 }
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
Definition: util.qc:956
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_TextWidth()

float draw_TextWidth ( string  text,
float  allowColorCodes,
vector  size 
)

Definition at line 293 of file draw.qc.

References boxToGlobalSize(), draw_fontscale, draw_scale, globalToBoxSize(), stringwidth(), v, and vector().

Referenced by draw_CenterText(), draw_CondensedFontFactor(), draw_TextWidth_WithColors(), draw_TextWidth_WithoutColors(), InputBox_draw(), Label_recalcPositionWithText(), m_tooltip(), XonoticDemoList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), and XonoticStatsList_drawListBoxItem().

294 {
295  //return strlen(theText);
296  //dprint("draw_TextWidth \"", theText, "\"\n");
297  vector v;
298  v = '0 0 0';
299  //float r;
300  v.x = stringwidth(theText, ICanHasKallerz, globalToBoxSize(boxToGlobalSize(SizeThxBye, draw_scale), draw_fontscale));
301  v = globalToBoxSize(v, draw_scale);
302  return v.x;
303 }
float stringwidth(string text, float handleColors, vector sz)
Definition: draw.qc:75
vector(float skel, float bonenum) _skel_get_boneabs_hidden
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_TextWidth_WithColors()

float draw_TextWidth_WithColors ( string  s,
vector  size 
)

Definition at line 380 of file draw.qc.

References draw_TextWidth().

Referenced by draw_TextLengthUpToWidth(), draw_TextShortenToWidth(), Label_draw(), Label_recalcPositionWithText(), and XonoticTextBox_setText().

381 {
382  return draw_TextWidth(s, true, theFontSize);
383 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_TextWidth_WithoutColors()

float draw_TextWidth_WithoutColors ( string  s,
vector  size 
)

Definition at line 385 of file draw.qc.

References draw_TextWidth().

Referenced by draw_TextLengthUpToWidth(), draw_TextShortenToWidth(), Label_draw(), Label_recalcPositionWithText(), m_tooltip(), and rewrapCampaign().

386 {
387  return draw_TextWidth(s, false, theFontSize);
388 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_VertButtonPicture()

void draw_VertButtonPicture ( vector  theOrigin,
string  pic,
vector  theSize,
vector  theColor,
float  theAlpha 
)

Definition at line 132 of file draw.qc.

References boxToGlobal(), boxToGlobalSize(), draw_alpha, draw_scale, draw_shift, draw_UseSkinFor(), drawsubpic(), eX, eY, height, and vector().

Referenced by ListBox_draw().

133 {
134  vector square;
135  vector width, height;
136  vector bH;
137  pic = draw_UseSkinFor(pic);
138  theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
139  theSize = boxToGlobalSize(theSize, draw_scale);
140  theAlpha *= draw_alpha;
141  width = eX * theSize.x;
142  height = eY * theSize.y;
143  if(theSize.y <= theSize.x * 2)
144  {
145  // button not high enough
146  // draw just upper and lower part then
147  square = eY * theSize.y * 0.5;
148  bH = eY * (0.25 * theSize.y / (theSize.x * 2));
149  drawsubpic(theOrigin, square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, 0);
150  drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, 0);
151  }
152  else
153  {
154  square = eY * theSize.x;
155  drawsubpic(theOrigin, width + square, pic, '0 0 0', '1 0.25 0', theColor, theAlpha, 0);
156  drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5 0', theColor, theAlpha, 0);
157  drawsubpic(theOrigin + height - square, width + square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, 0);
158  }
159 }
const vector eY
Definition: vector.qh:45
string draw_UseSkinFor(string pic)
Definition: util.qc:206
float height
Definition: jumppads.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ globalToBox()

vector globalToBox ( vector  v,
vector  shift,
vector  scale 
)

Definition at line 30 of file draw.qc.

References v.

Referenced by Container_mouseDrag(), Container_mouseMove(), Container_mouseRelease(), InputContainer__changeFocusXY(), ListBox_mouseRelease(), m_draw(), m_findtooltipitem(), and ModalController_showChild().

31 {
32  v -= theOrigin;
33  v.x /= theScale.x;
34  v.y /= theScale.y;
35  return v;
36 }
vector v
Definition: ent_cs.qc:116
+ Here is the caller graph for this function:

◆ globalToBoxSize()

vector globalToBoxSize ( vector  v,
vector  scale 
)

Definition at line 38 of file draw.qc.

References v.

Referenced by BorderImage_draw(), draw_Text(), draw_TextWidth(), m_draw(), ModalController_draw(), ModalController_showChild(), Nexposee_draw(), XonoticColorpickerString_draw(), XonoticCrosshairPicker_cellDraw(), and XonoticCrosshairPreview_draw().

39 {
40  v.x /= theScale.x;
41  v.y /= theScale.y;
42  return v;
43 }
vector v
Definition: ent_cs.qc:116
+ Here is the caller graph for this function:

Variable Documentation

◆ draw_alpha

◆ draw_scale

◆ draw_shift

◆ drawfontscale

vector drawfontscale

Definition at line 4 of file draw.qh.