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 + 2
 
#define draw_endBoldFont()   drawfont = FONT_USER + 1
 
#define drawcharacter(position, character, scale, rgb, alpha, flag)   drawcharacter_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
 
#define drawcolorcodedstring(position, text, scale, alpha, flag)   drawcolorcodedstring_builtin(HUD_Shift(position), text, scale, alpha, flag)
 
#define drawcolorcodedstring2(position, text, scale, rgb, alpha, flag)   drawcolorcodedstring2_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
 
#define drawfill(position, size, rgb, alpha, flag)   drawfill_builtin(HUD_Shift(position), HUD_Scale(size), rgb, alpha, flag)
 
#define drawpic(position, pic, size, rgb, alpha, flag)   drawpic_builtin(HUD_Shift(position), pic, HUD_Scale(size), rgb, alpha, flag)
 
#define drawpic_aspect(pos, pic, mySize, color, theAlpha, drawflag)
 
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
 
#define drawpic_skin(pos, pic, sz, color, theAlpha, drawflag)
 
#define drawsetcliparea(xposition, yposition, w, h)   drawsetcliparea_builtin(HUD_ShiftX(xposition), HUD_ShiftY(yposition), HUD_ScaleX(w), HUD_ScaleY(h))
 
#define drawstring(position, text, scale, rgb, alpha, flag)   drawstring_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
 

Functions

void drawborderlines (float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag)
 
void DrawCircleClippedPic (vector centre, float radi, string pic, float f, vector rgb, float a, float drawflag)
 
void drawcolorcodedstring_aspect (vector pos, string text, vector sz, float theAlpha, float drawflag)
 
void drawcolorcodedstring_aspect_expanding (vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp)
 
void drawcolorcodedstring_expanding (vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp)
 
void drawpic_aspect_skin_expanding (vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 
void drawpic_aspect_skin_expanding_two (vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 
void drawpic_tiled (vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag)
 
void drawstring_aspect (vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
 
void drawstring_aspect_expanding (vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp)
 
void drawstring_expanding (vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 
vector expandingbox_resize_centered_box_offset (float sz, vector boxsize, float boxxsizefactor)
 
float expandingbox_sizefactor_from_fadelerp (float fadelerp)
 
void PolyDrawModel (entity e)
 
float PolyDrawModelSurface (entity e, float i_s)
 
float stringwidth (string text, float handleColors, vector sz)
 

Variables

float _drawpic_imgaspect
 
vector _drawpic_imgsize
 
float _drawpic_oldsz
 
string _drawpic_picpath
 
vector _drawpic_sz
 
vector drawfontscale
 

Macro Definition Documentation

◆ draw_beginBoldFont

◆ draw_endBoldFont

◆ drawcharacter

#define drawcharacter (   position,
  character,
  scale,
  rgb,
  alpha,
  flag 
)    drawcharacter_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)

Definition at line 24 of file draw.qh.

◆ drawcolorcodedstring

#define drawcolorcodedstring (   position,
  text,
  scale,
  alpha,
  flag 
)    drawcolorcodedstring_builtin(HUD_Shift(position), text, scale, alpha, flag)

Definition at line 30 of file draw.qh.

◆ drawcolorcodedstring2

#define drawcolorcodedstring2 (   position,
  text,
  scale,
  rgb,
  alpha,
  flag 
)    drawcolorcodedstring2_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)

Definition at line 33 of file draw.qh.

◆ drawfill

#define drawfill (   position,
  size,
  rgb,
  alpha,
  flag 
)    drawfill_builtin(HUD_Shift(position), HUD_Scale(size), rgb, alpha, flag)

Definition at line 36 of file draw.qh.

◆ drawpic

#define drawpic (   position,
  pic,
  size,
  rgb,
  alpha,
  flag 
)    drawpic_builtin(HUD_Shift(position), pic, HUD_Scale(size), rgb, alpha, flag)

Definition at line 21 of file draw.qh.

◆ drawpic_aspect

#define drawpic_aspect (   pos,
  pic,
  mySize,
  color,
  theAlpha,
  drawflag 
)
Value:
MACRO_BEGIN \
_drawpic_imgsize = draw_getimagesize(pic);\
if(_drawpic_imgsize != '0 0 0') {\
_drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
_drawpic_sz = mySize;\
_drawpic_oldsz = _drawpic_sz.x;\
_drawpic_sz.x = _drawpic_sz.y * _drawpic_imgaspect;\
if(_drawpic_sz.x)\
drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), pic, _drawpic_sz, color, theAlpha, drawflag);\
} else {\
_drawpic_oldsz = _drawpic_sz.y;\
_drawpic_sz.y = _drawpic_sz.x / _drawpic_imgaspect;\
if(_drawpic_sz.y)\
drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
}\
}\
MACRO_END
vector color
const vector eY
Definition: vector.qh:45
float _drawpic_imgaspect
Definition: draw.qh:52
vector _drawpic_sz
Definition: draw.qh:54
const vector eX
Definition: vector.qh:44
vector _drawpic_imgsize
Definition: draw.qh:53
float _drawpic_oldsz
Definition: draw.qh:55

Definition at line 57 of file draw.qh.

◆ drawpic_aspect_skin

#define drawpic_aspect_skin (   pos,
  pic,
  sz,
  color,
  theAlpha,
  drawflag 
)
Value:
MACRO_BEGIN \
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
MACRO_END
vector color
string string_null
Definition: nil.qh:9
string hud_skin_path
Definition: hud.qh:133
string _drawpic_picpath
Definition: draw.qh:56
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))

Definition at line 78 of file draw.qh.

Referenced by DrawAmmoItem(), DrawCAItem(), DrawDomItem(), DrawNumIcon_expanding(), drawpic_aspect_skin_expanding(), HUD_HealthArmor(), HUD_Mod_Keepaway(), HUD_Mod_KH(), HUD_Mod_NexBall(), HUD_PressedKeys(), HUD_Weapons(), and Item_ItemsTime_Allow().

◆ drawpic_skin

#define drawpic_skin (   pos,
  pic,
  sz,
  color,
  theAlpha,
  drawflag 
)
Value:
MACRO_BEGIN \
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
MACRO_END
vector color
string string_null
Definition: nil.qh:9
string hud_skin_path
Definition: hud.qh:133
string _drawpic_picpath
Definition: draw.qh:56
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))

Definition at line 89 of file draw.qh.

Referenced by drawpic_aspect_skin_expanding_two().

◆ drawsetcliparea

#define drawsetcliparea (   xposition,
  yposition,
  w,
 
)    drawsetcliparea_builtin(HUD_ShiftX(xposition), HUD_ShiftY(yposition), HUD_ScaleX(w), HUD_ScaleY(h))

Definition at line 39 of file draw.qh.

◆ drawstring

#define drawstring (   position,
  text,
  scale,
  rgb,
  alpha,
  flag 
)    drawstring_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)

Definition at line 27 of file draw.qh.

Function Documentation

◆ drawborderlines()

void drawborderlines ( float  thickness,
vector  pos,
vector  dim,
vector  color,
float  theAlpha,
float  drawflag 
)

Definition at line 5 of file draw.qc.

References drawfill(), and vector().

Referenced by GameTypeVote_DrawGameTypeItem(), and MapVote_DrawMapItem().

6 {
7  vector line_dim = '0 0 0';
8 
9  // left and right lines
10  pos.x -= thickness;
11  line_dim.x = thickness;
12  line_dim.y = dim.y;
13  drawfill(pos, line_dim, color, theAlpha, drawflag);
14  drawfill(pos + (dim.x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag);
15 
16  // upper and lower lines
17  pos.y -= thickness;
18  line_dim.x = dim.x + thickness * 2; // make upper and lower lines longer
19  line_dim.y = thickness;
20  drawfill(pos, line_dim, color, theAlpha, drawflag);
21  drawfill(pos + (dim.y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag);
22 }
vector color
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawCircleClippedPic()

void DrawCircleClippedPic ( vector  centre,
float  radi,
string  pic,
float  f,
vector  rgb,
float  a,
float  drawflag 
)

Definition at line 182 of file draw.qc.

References cos(), fabs(), HUD_Scale(), HUD_Shift(), M_PI, sin(), v, and vector().

Referenced by HUD_Crosshair(), and HUD_Draw().

183 {
184  vector ringsize, v, t;
185  ringsize = radi * '1 1 0';
186  centre = HUD_Shift(centre);
187  ringsize = HUD_Scale(ringsize);
188 
189  if(f >= 1)
190  {
191  // draw full rectangle
192  R_BeginPolygon(pic, drawflag, true);
193  v = centre; t = '0.5 0.5 0';
194  v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
195  R_PolygonVertex(v, t, rgb, a);
196 
197  v = centre; t = '0.5 0.5 0';
198  v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
199  R_PolygonVertex(v, t, rgb, a);
200 
201  v = centre; t = '0.5 0.5 0';
202  v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
203  R_PolygonVertex(v, t, rgb, a);
204 
205  v = centre; t = '0.5 0.5 0';
206  v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0';
207  R_PolygonVertex(v, t, rgb, a);
208  R_EndPolygon();
209  return; // Complete rectangle, nothing more needed.
210  }
211 
212  float co = cos(f * 2 * M_PI);
213  float si = sin(f * 2 * M_PI);
214  float q = fabs(co) + fabs(si);
215  co /= q;
216  si /= q;
217 
218  if(f > 0.75)
219  {
220  // draw upper half in full
221  R_BeginPolygon(pic, drawflag, true);
222  v = centre; t = '0.5 0.5 0';
223  v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
224  R_PolygonVertex(v, t, rgb, a);
225 
226  v = centre; t = '0.5 0.5 0';
227  v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
228  R_PolygonVertex(v, t, rgb, a);
229 
230  v = centre; t = '0.5 0.5 0';
231  v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
232  R_PolygonVertex(v, t, rgb, a);
233  R_EndPolygon();
234  // draw clipped lower half as a quad
235  R_BeginPolygon(pic, drawflag, true);
236  v = centre; t = '0.5 0.5 0';
237  R_PolygonVertex(v, t, rgb, a);
238 
239  v = centre; t = '0.5 0.5 0';
240  v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
241  R_PolygonVertex(v, t, rgb, a);
242 
243  v = centre; t = '0.5 0.5 0';
244  v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0';
245  R_PolygonVertex(v, t, rgb, a);
246  }
247  else if(f > 0.5)
248  {
249  // draw upper half in full
250  R_BeginPolygon(pic, drawflag, true);
251  v = centre; t = '0.5 0.5 0';
252  v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
253  R_PolygonVertex(v, t, rgb, a);
254 
255  v = centre; t = '0.5 0.5 0';
256  v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
257  R_PolygonVertex(v, t, rgb, a);
258 
259  v = centre; t = '0.5 0.5 0';
260  v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
261  R_PolygonVertex(v, t, rgb, a);
262  R_EndPolygon();
263  // draw clipped lower half as a triangle
264  R_BeginPolygon(pic, drawflag, true);
265  v = centre; t = '0.5 0.5 0';
266  R_PolygonVertex(v, t, rgb, a);
267 
268  v = centre; t = '0.5 0.5 0';
269  v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
270  R_PolygonVertex(v, t, rgb, a);
271  }
272  else if(f > 0.25)
273  {
274  // draw clipped lower half as a quad
275  R_BeginPolygon(pic, drawflag, true);
276  v = centre; t = '0.5 0.5 0';
277  R_PolygonVertex(v, t, rgb, a);
278 
279  v = centre; t = '0.5 0.5 0';
280  v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
281  R_PolygonVertex(v, t, rgb, a);
282 
283  v = centre; t = '0.5 0.5 0';
284  v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
285  R_PolygonVertex(v, t, rgb, a);
286  }
287  else if (f > 0)
288  {
289  // draw clipped lower half as a triangle
290  R_BeginPolygon(pic, drawflag, true);
291  v = centre; t = '0.5 0.5 0';
292  R_PolygonVertex(v, t, rgb, a);
293 
294  v = centre; t = '0.5 0.5 0';
295  v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
296  R_PolygonVertex(v, t, rgb, a);
297  }
298  else
299  {
300  // Nothing to draw.
301  return;
302  }
303 
304  // The last, moving vertex.
305  v = centre; t = '0.5 0.5 0';
306  v.x += co * 0.5 * ringsize.x; t += co * '0.5 0.5 0';
307  v.y += si * 0.5 * ringsize.y; t += si * '0.5 -0.5 0';
308  R_PolygonVertex(v, t, rgb, a);
309  R_EndPolygon();
310 }
vector HUD_Shift(vector v)
Definition: hud.qc:104
vector HUD_Scale(vector v)
Definition: hud.qc:97
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const float M_PI
Definition: csprogsdefs.qc:269
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawcolorcodedstring_aspect()

void drawcolorcodedstring_aspect ( vector  pos,
string  text,
vector  sz,
float  theAlpha,
float  drawflag 
)

Definition at line 108 of file draw.qc.

References drawcolorcodedstring(), and SET_POS_AND_SZ_Y_ASPECT.

108  {
110  drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag);
111 }
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors)
Definition: draw.qc:84
+ Here is the call graph for this function:

◆ drawcolorcodedstring_aspect_expanding()

void drawcolorcodedstring_aspect_expanding ( vector  pos,
string  text,
vector  sz,
float  theAlpha,
float  drawflag,
float  fadelerp 
)

Definition at line 147 of file draw.qc.

References drawcolorcodedstring_expanding(), and SET_POS_AND_SZ_Y_ASPECT.

147  {
149  drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz.y, theAlpha, drawflag, fadelerp);
150 }
void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp)
Definition: draw.qc:136
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors)
Definition: draw.qc:84
+ Here is the call graph for this function:

◆ drawcolorcodedstring_expanding()

void drawcolorcodedstring_expanding ( vector  position,
string  text,
vector  theScale,
float  theAlpha,
float  flag,
float  fadelerp 
)

Definition at line 136 of file draw.qc.

References drawcolorcodedstring(), drawfontscale, expandingbox_resize_centered_box_offset(), expandingbox_sizefactor_from_fadelerp(), and hud_scale.

Referenced by drawcolorcodedstring_aspect_expanding().

137 {
138  float sz;
140 
141  drawfontscale = hud_scale * sz;
142  // eventually replace with drawcolorcodedstring
143  drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth_builtin(text, true, theScale * (sz / drawfontscale.x)) / (theScale.x * sz)), text, theScale * (sz / drawfontscale.x), theAlpha * (1 - fadelerp), flag);
145 }
vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
Definition: draw.qc:55
vector hud_scale
Definition: hud.qh:216
vector drawfontscale
Definition: draw.qh:3
float expandingbox_sizefactor_from_fadelerp(float fadelerp)
Definition: draw.qc:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawpic_aspect_skin_expanding()

void drawpic_aspect_skin_expanding ( vector  position,
string  pic,
vector  theScale,
vector  rgb,
float  theAlpha,
float  flag,
float  fadelerp 
)

Definition at line 61 of file draw.qc.

References drawpic_aspect_skin, expandingbox_resize_centered_box_offset(), and expandingbox_sizefactor_from_fadelerp().

Referenced by DrawNumIcon_expanding(), drawpic_aspect_skin_expanding_two(), HUD_Mod_Keepaway(), and Item_ItemsTime_Allow().

62 {
63  float sz;
65 
66  drawpic_aspect_skin(position + expandingbox_resize_centered_box_offset(sz, theScale, 1), pic, theScale * sz, rgb, theAlpha * (1 - fadelerp), flag);
67 }
vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
Definition: draw.qc:55
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition: draw.qh:78
float expandingbox_sizefactor_from_fadelerp(float fadelerp)
Definition: draw.qc:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawpic_aspect_skin_expanding_two()

void drawpic_aspect_skin_expanding_two ( vector  position,
string  pic,
vector  theScale,
vector  rgb,
float  theAlpha,
float  flag,
float  fadelerp 
)

Definition at line 69 of file draw.qc.

References drawpic_aspect_skin_expanding(), and drawpic_skin.

70 {
71  drawpic_aspect_skin_expanding(position, pic, theScale, rgb, theAlpha, flag, fadelerp);
72  drawpic_skin(position, pic, theScale, rgb, theAlpha * fadelerp, flag);
73 }
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition: draw.qc:61
#define drawpic_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition: draw.qh:89
+ Here is the call graph for this function:

◆ drawpic_tiled()

void drawpic_tiled ( vector  pos,
string  pic,
vector  sz,
vector  area,
vector  color,
float  theAlpha,
float  drawflag 
)

Definition at line 24 of file draw.qc.

References drawsubpic(), HUD_Scale(), HUD_Shift(), min(), and vector().

Referenced by HUD_Panel_HlBorder(), Scoreboard_MakeTable(), and Scoreboard_Rankings_Draw().

25 {
26  pos = HUD_Shift(pos);
27  sz = HUD_Scale(sz);
28  area = HUD_Scale(area);
29 
30  vector current_pos = '0 0 0', end_pos, new_size = '0 0 0', ratio = '0 0 0';
31  end_pos = pos + area;
32 
33  current_pos.y = pos.y;
34  while (current_pos.y < end_pos.y)
35  {
36  current_pos.x = pos.x;
37  while (current_pos.x < end_pos.x)
38  {
39  new_size.x = min(sz.x, end_pos.x - current_pos.x);
40  new_size.y = min(sz.y, end_pos.y - current_pos.y);
41  ratio.x = new_size.x / sz.x;
42  ratio.y = new_size.y / sz.y;
43  drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, theAlpha, drawflag);
44  current_pos.x += sz.x;
45  }
46  current_pos.y += sz.y;
47  }
48 }
vector color
vector HUD_Shift(vector v)
Definition: hud.qc:104
vector HUD_Scale(vector v)
Definition: hud.qc:97
vector(float skel, float bonenum) _skel_get_boneabs_hidden
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:

◆ drawstring_aspect()

void drawstring_aspect ( vector  pos,
string  text,
vector  sz,
vector  color,
float  theAlpha,
float  drawflag 
)

Definition at line 102 of file draw.qc.

References drawstring(), and SET_POS_AND_SZ_Y_ASPECT.

Referenced by DrawAmmoItem(), DrawCAItem(), DrawDomItem(), DrawNumIcon_expanding(), HUD_Draw(), HUD_EngineInfo(), HUD_Physics(), HUD_Score(), HUD_Score_Rankings(), HUD_StrafeHUD(), Item_ItemsTime_Allow(), and race_showTime().

102  {
104  drawstring(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag);
105 }
vector color
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors)
Definition: draw.qc:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawstring_aspect_expanding()

void drawstring_aspect_expanding ( vector  pos,
string  text,
vector  sz,
vector  color,
float  theAlpha,
float  drawflag,
float  fadelerp 
)

Definition at line 131 of file draw.qc.

References drawstring_expanding(), and SET_POS_AND_SZ_Y_ASPECT.

Referenced by DrawNumIcon_expanding(), and race_showTime().

131  {
133  drawstring_expanding(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag, fadelerp);
134 }
vector color
void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition: draw.qc:113
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors)
Definition: draw.qc:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawstring_expanding()

void drawstring_expanding ( vector  position,
string  text,
vector  theScale,
vector  rgb,
float  theAlpha,
float  flag,
float  fadelerp 
)

Definition at line 113 of file draw.qc.

References drawfontscale, drawstring(), expandingbox_resize_centered_box_offset(), expandingbox_sizefactor_from_fadelerp(), HUD_Scale(), hud_scale, and vector().

Referenced by drawstring_aspect_expanding().

114 {
115  float sz;
117 
118  drawfontscale = hud_scale * sz;
119  vector dfs = drawfontscale;
120  drawfontscale = sz * '1 1 0';
121  float textaspect = stringwidth_builtin(text, false, theScale * (sz / drawfontscale.x)) / (theScale.x * sz);
122  drawfontscale = dfs;
123  drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, textaspect), text, HUD_Scale(theScale * (sz / drawfontscale.x)), rgb, theAlpha * (1 - fadelerp), flag);
124  // width parameter:
125  // (scale_x * sz / drawfontscale.x) * drawfontscale.x * SIZE1 / (scale_x * sz)
126  // SIZE1
128 }
vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
Definition: draw.qc:55
vector hud_scale
Definition: hud.qh:216
vector drawfontscale
Definition: draw.qh:3
vector HUD_Scale(vector v)
Definition: hud.qc:97
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float expandingbox_sizefactor_from_fadelerp(float fadelerp)
Definition: draw.qc:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expandingbox_resize_centered_box_offset()

vector expandingbox_resize_centered_box_offset ( float  sz,
vector  boxsize,
float  boxxsizefactor 
)

Definition at line 55 of file draw.qc.

Referenced by drawcolorcodedstring_expanding(), drawpic_aspect_skin_expanding(), and drawstring_expanding().

56 {
57  boxsize.x *= boxxsizefactor; // easier interface for text
58  return boxsize * (0.5 * (1 - sz));
59 }
+ Here is the caller graph for this function:

◆ expandingbox_sizefactor_from_fadelerp()

float expandingbox_sizefactor_from_fadelerp ( float  fadelerp)

Definition at line 50 of file draw.qc.

Referenced by drawcolorcodedstring_expanding(), drawpic_aspect_skin_expanding(), and drawstring_expanding().

51 {
52  return 1.2 / (1.2 - fadelerp);
53 }
+ Here is the caller graph for this function:

◆ PolyDrawModel()

void PolyDrawModel ( entity  e)

Definition at line 174 of file draw.qc.

References PolyDrawModelSurface().

Referenced by DrawDebugModel().

175 {
176  float i_s;
177  for(i_s = 0; ; ++i_s)
178  if(!PolyDrawModelSurface(e, i_s))
179  break;
180 }
float PolyDrawModelSurface(entity e, float i_s)
Definition: draw.qc:153
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PolyDrawModelSurface()

float PolyDrawModelSurface ( entity  e,
float  i_s 
)

Definition at line 153 of file draw.qc.

References SPA_TEXCOORDS0, and vector().

Referenced by PolyDrawModel().

154 {
155  float i_t;
156  float n_t;
157  vector tri;
158  string tex;
159  tex = getsurfacetexture(e, i_s);
160  if (!tex)
161  return 0; // this is beyond the last one
162  n_t = getsurfacenumtriangles(e, i_s);
163  for(i_t = 0; i_t < n_t; ++i_t)
164  {
165  tri = getsurfacetriangle(e, i_s, i_t);
166  R_BeginPolygon(tex, 0, false);
167  R_PolygonVertex(getsurfacepoint(e, i_s, tri.x), getsurfacepointattribute(e, i_s, tri.x, SPA_TEXCOORDS0), '1 1 1', 1);
168  R_PolygonVertex(getsurfacepoint(e, i_s, tri.y), getsurfacepointattribute(e, i_s, tri.y, SPA_TEXCOORDS0), '1 1 1', 1);
169  R_PolygonVertex(getsurfacepoint(e, i_s, tri.z), getsurfacepointattribute(e, i_s, tri.z, SPA_TEXCOORDS0), '1 1 1', 1);
170  R_EndPolygon();
171  }
172  return 1;
173 }
float SPA_TEXCOORDS0
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stringwidth()

float stringwidth ( string  text,
float  handleColors,
vector  sz 
)

Definition at line 75 of file draw.qc.

76 {
77  vector dfs = drawfontscale;
78  drawfontscale = '1 1 0';
79  float r = stringwidth_builtin(text, handleColors, sz);
80  drawfontscale = dfs;
81  return r;
82 }
vector drawfontscale
Definition: draw.qh:3
vector(float skel, float bonenum) _skel_get_boneabs_hidden

Variable Documentation

◆ _drawpic_imgaspect

float _drawpic_imgaspect

Definition at line 52 of file draw.qh.

◆ _drawpic_imgsize

vector _drawpic_imgsize

Definition at line 53 of file draw.qh.

◆ _drawpic_oldsz

float _drawpic_oldsz

Definition at line 55 of file draw.qh.

◆ _drawpic_picpath

string _drawpic_picpath

Definition at line 56 of file draw.qh.

◆ _drawpic_sz

vector _drawpic_sz

Definition at line 54 of file draw.qh.

◆ drawfontscale