Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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()
#define draw_endBoldFont()
#define drawcharacter(position, character, scale, rgb, alpha, flag)
#define drawcolorcodedstring(position, text, scale, alpha, flag)
#define drawcolorcodedstring2(position, text, scale, rgb, alpha, flag)
#define drawfill(position, size, rgb, alpha, flag)
#define drawpic(position, pic, 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)
#define drawstring(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 )
Value:
drawcharacter_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
float alpha
Definition items.qc:13
vector HUD_Shift(vector v)
Definition hud.qc:105
float scale
Definition projectile.qc:14

Definition at line 24 of file draw.qh.

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

Referenced by float().

◆ drawcolorcodedstring

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

◆ drawcolorcodedstring2

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

Definition at line 33 of file draw.qh.

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

Referenced by vector().

◆ drawfill

◆ drawpic

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

◆ 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_sz = mySize;\
if(_drawpic_sz.x)\
drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), pic, _drawpic_sz, color, theAlpha, drawflag);\
} else {\
if(_drawpic_sz.y)\
drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
}\
}\
vector _drawpic_imgsize
Definition draw.qh:53
vector _drawpic_sz
Definition draw.qh:54
float _drawpic_oldsz
Definition draw.qh:55
float _drawpic_imgaspect
Definition draw.qh:52
vector color
Definition dynlight.qc:15
#define MACRO_END
Definition macro.qh:7
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44

Definition at line 57 of file draw.qh.

57#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
58 MACRO_BEGIN \
59 _drawpic_imgsize = draw_getimagesize(pic);\
60 if(_drawpic_imgsize != '0 0 0') {\
61 _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
62 _drawpic_sz = mySize;\
63 if(_drawpic_sz.x/_drawpic_sz.y > _drawpic_imgaspect) {\
64 _drawpic_oldsz = _drawpic_sz.x;\
65 _drawpic_sz.x = _drawpic_sz.y * _drawpic_imgaspect;\
66 if(_drawpic_sz.x)\
67 drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), pic, _drawpic_sz, color, theAlpha, drawflag);\
68 } else {\
69 _drawpic_oldsz = _drawpic_sz.y;\
70 _drawpic_sz.y = _drawpic_sz.x / _drawpic_imgaspect;\
71 if(_drawpic_sz.y)\
72 drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
73 }\
74 }\
75 MACRO_END

◆ 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);\
string _drawpic_picpath
Definition draw.qh:56
string hud_skin_path
Definition hud.qh:136
string precache_pic(string name,...)
string string_null
Definition nil.qh:9
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

Definition at line 78 of file draw.qh.

78#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
79 MACRO_BEGIN \
80 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
81 if(precache_pic(_drawpic_picpath) == "")\
82 _drawpic_picpath = strcat("gfx/hud/default/", pic);\
83 drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
84 _drawpic_picpath = string_null;\
85 MACRO_END

Referenced by DrawAmmoItem(), DrawAmmoNades(), DrawCAItem(), DrawDomItem(), DrawItemsTimeItem(), DrawNumIcon_expanding(), drawpic_aspect_skin_expanding(), HUD_HealthArmor(), HUD_Mod_Keepaway(), HUD_Mod_KH(), HUD_Mod_LMS_Draw(), HUD_Mod_NexBall(), HUD_Mod_Race(), HUD_Mod_TeamKeepaway(), HUD_Notify(), HUD_PressedKeys(), Scoreboard_AccuracyStats_Draw(), Scoreboard_ItemStats_Draw(), and Weapons_Draw().

◆ 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);\

Definition at line 88 of file draw.qh.

88#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
89 MACRO_BEGIN \
90 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
91 if(precache_pic(_drawpic_picpath) == "")\
92 _drawpic_picpath = strcat("gfx/hud/default/", pic);\
93 drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
94 _drawpic_picpath = string_null;\
95 MACRO_END

Referenced by drawpic_aspect_skin_expanding_two(), HUD_Vote(), and Vehicles_drawHUD().

◆ drawsetcliparea

#define drawsetcliparea ( xposition,
yposition,
w,
h )
Value:
drawsetcliparea_builtin(HUD_ShiftX(xposition), HUD_ShiftY(yposition), HUD_ScaleX(w), HUD_ScaleY(h))
#define HUD_ScaleX(f)
Definition hud.qh:15
#define HUD_ShiftY(f)
Definition hud.qh:18
#define HUD_ScaleY(f)
Definition hud.qh:16
#define HUD_ShiftX(f)
Definition hud.qh:17

Definition at line 39 of file draw.qh.

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

Referenced by _draw_SetClip(), draw_ClearClip(), DrawDomItem(), HUD_Radar(), HUD_Vote(), Vehicles_drawHUD(), void(), and Weapons_Draw().

◆ drawstring

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.

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}
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
vector
Definition self.qh:92

References color, drawfill, and vector.

Referenced by GameTypeVote_DrawGameTypeItem(), and MapVote_DrawMapItem().

◆ DrawCircleClippedPic()

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

Definition at line 190 of file draw.qc.

191{
192 vector ringsize, v, t;
193 ringsize = radi * '1 1 0';
194 centre = HUD_Shift(centre);
195 ringsize = HUD_Scale(ringsize);
196
197 if(f >= 1)
198 {
199 // draw full rectangle
200 R_BeginPolygon(pic, drawflag, true);
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
209 v = centre; t = '0.5 0.5 0';
210 v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
211 R_PolygonVertex(v, t, rgb, a);
212
213 v = centre; t = '0.5 0.5 0';
214 v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0';
215 R_PolygonVertex(v, t, rgb, a);
216 R_EndPolygon();
217 return; // Complete rectangle, nothing more needed.
218 }
219
220 float co = cos(f * (2 * M_PI));
221 float si = sin(f * (2 * M_PI));
222 float q = fabs(co) + fabs(si);
223 co /= q;
224 si /= q;
225
226 if(f > 0.75)
227 {
228 // draw upper half in full
229 R_BeginPolygon(pic, drawflag, true);
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
234 v = centre; t = '0.5 0.5 0';
235 v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
236 R_PolygonVertex(v, t, rgb, a);
237
238 v = centre; t = '0.5 0.5 0';
239 v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
240 R_PolygonVertex(v, t, rgb, a);
241 R_EndPolygon();
242 // draw clipped lower half as a quad
243 R_BeginPolygon(pic, drawflag, true);
244 v = centre; t = '0.5 0.5 0';
245 R_PolygonVertex(v, t, rgb, a);
246
247 v = centre; t = '0.5 0.5 0';
248 v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
249 R_PolygonVertex(v, t, rgb, a);
250
251 v = centre; t = '0.5 0.5 0';
252 v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0';
253 R_PolygonVertex(v, t, rgb, a);
254 }
255 else if(f > 0.5)
256 {
257 // draw upper half in full
258 R_BeginPolygon(pic, drawflag, true);
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
263 v = centre; t = '0.5 0.5 0';
264 v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
265 R_PolygonVertex(v, t, rgb, a);
266
267 v = centre; t = '0.5 0.5 0';
268 v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
269 R_PolygonVertex(v, t, rgb, a);
270 R_EndPolygon();
271 // draw clipped lower half as a triangle
272 R_BeginPolygon(pic, drawflag, true);
273 v = centre; t = '0.5 0.5 0';
274 R_PolygonVertex(v, t, rgb, a);
275
276 v = centre; t = '0.5 0.5 0';
277 v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0';
278 R_PolygonVertex(v, t, rgb, a);
279 }
280 else if(f > 0.25)
281 {
282 // draw clipped lower half as a quad
283 R_BeginPolygon(pic, drawflag, true);
284 v = centre; t = '0.5 0.5 0';
285 R_PolygonVertex(v, t, rgb, a);
286
287 v = centre; t = '0.5 0.5 0';
288 v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
289 R_PolygonVertex(v, t, rgb, a);
290
291 v = centre; t = '0.5 0.5 0';
292 v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0';
293 R_PolygonVertex(v, t, rgb, a);
294 }
295 else if (f > 0)
296 {
297 // draw clipped lower half as a triangle
298 R_BeginPolygon(pic, drawflag, true);
299 v = centre; t = '0.5 0.5 0';
300 R_PolygonVertex(v, t, rgb, a);
301
302 v = centre; t = '0.5 0.5 0';
303 v.x += 0.5 * ringsize.x; t += '0.5 0.5 0';
304 R_PolygonVertex(v, t, rgb, a);
305 }
306 else
307 {
308 // Nothing to draw.
309 return;
310 }
311
312 // The last, moving vertex.
313 v = centre; t = '0.5 0.5 0';
314 v.x += co * 0.5 * ringsize.x; t += co * '0.5 0.5 0';
315 v.y += si * 0.5 * ringsize.y; t += si * '0.5 -0.5 0';
316 R_PolygonVertex(v, t, rgb, a);
317 R_EndPolygon();
318}
#define M_PI
Definition mathlib.qh:108
float cos(float f)
float sin(float f)
float fabs(float f)

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

Referenced by HUD_Crosshair(), and HUD_Draw().

◆ drawcolorcodedstring_aspect()

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

Definition at line 116 of file draw.qc.

116 {
117 DRAWSTRING_ASPECT_SCALE(pos, text, sz, true);
118 drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag);
119}
#define DRAWSTRING_ASPECT_SCALE(pos, text, sz, allow_colors)
Definition draw.qc:88
#define drawcolorcodedstring(position, text, scale, alpha, flag)
Definition draw.qh:30

References drawcolorcodedstring, DRAWSTRING_ASPECT_SCALE, and vector.

Referenced by HUD_Mod_Race(), and HUD_Vote().

◆ drawcolorcodedstring_aspect_expanding()

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

Definition at line 155 of file draw.qc.

155 {
156 DRAWSTRING_ASPECT_SCALE(pos, text, sz, true);
157 drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz.y, theAlpha, drawflag, fadelerp);
158}
void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp)
Definition draw.qc:144

References drawcolorcodedstring_expanding(), DRAWSTRING_ASPECT_SCALE, and vector.

◆ drawcolorcodedstring_expanding()

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

Definition at line 144 of file draw.qc.

145{
146 float sz;
148
150 // eventually replace with drawcolorcodedstring
151 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);
153}
float expandingbox_sizefactor_from_fadelerp(float fadelerp)
Definition draw.qc:50
vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
Definition draw.qc:55
vector drawfontscale
Definition draw.qh:3
vector hud_scale
Definition hud.qh:221

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

Referenced by drawcolorcodedstring_aspect_expanding().

◆ 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.

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}
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition draw.qh:78

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

Referenced by DrawAmmoNades(), DrawItemsTimeItem(), DrawNumIcon_expanding(), drawpic_aspect_skin_expanding_two(), HUD_Mod_Keepaway(), and HUD_Mod_TeamKeepaway().

◆ 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.

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:88

References drawpic_aspect_skin_expanding(), drawpic_skin, and vector.

◆ 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.

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}
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
float min(float f,...)

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

Referenced by HUD_Panel_HlBorder(), Scoreboard_AccuracyStats_Draw(), Scoreboard_ItemStats_Draw(), Scoreboard_MakeTable(), Scoreboard_MapStats_Draw(), and Scoreboard_Rankings_Draw().

◆ drawstring_aspect()

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

Definition at line 110 of file draw.qc.

110 {
111 DRAWSTRING_ASPECT_SCALE(pos, text, sz, false);
112 drawstring(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag);
113}
#define drawstring(position, text, scale, rgb, alpha, flag)
Definition draw.qh:27

References color, drawstring, DRAWSTRING_ASPECT_SCALE, and vector.

Referenced by DrawAmmoItem(), DrawAmmoNades(), DrawCAItem(), DrawDomItem(), DrawItemsTimeItem(), DrawNumIcon_expanding(), HUD_Draw(), HUD_EngineInfo(), HUD_Mod_LMS_Draw(), HUD_Mod_Race(), HUD_Mod_Survival(), HUD_Physics(), HUD_Score(), HUD_Score_Rankings(), HUD_Timer(), HUD_Vote(), race_showTime(), StrafeHUD_DrawTextIndicator(), and Weapons_Draw().

◆ drawstring_aspect_expanding()

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

Definition at line 139 of file draw.qc.

139 {
140 DRAWSTRING_ASPECT_SCALE(pos, text, sz, false);
141 drawstring_expanding(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag, fadelerp);
142}
void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition draw.qc:121

References color, DRAWSTRING_ASPECT_SCALE, drawstring_expanding(), and vector.

Referenced by DrawNumIcon_expanding(), and race_showTime().

◆ drawstring_expanding()

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

Definition at line 121 of file draw.qc.

122{
123 float sz;
125
127 vector dfs = drawfontscale;
128 drawfontscale = sz * '1 1 0';
129 float textaspect = stringwidth_builtin(text, false, theScale * (sz / drawfontscale.x)) / (theScale.x * sz);
130 drawfontscale = dfs;
131 drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, textaspect), text, HUD_Scale(theScale * (sz / drawfontscale.x)), rgb, theAlpha * (1 - fadelerp), flag);
132 // width parameter:
133 // (scale_x * sz / drawfontscale.x) * drawfontscale.x * SIZE1 / (scale_x * sz)
134 // SIZE1
136}

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

Referenced by drawstring_aspect_expanding(), and HUD_RaceTimer().

◆ 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.

56{
57 boxsize.x *= boxxsizefactor; // easier interface for text
58 return boxsize * (0.5 * (1 - sz));
59}

References vector.

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

◆ expandingbox_sizefactor_from_fadelerp()

float expandingbox_sizefactor_from_fadelerp ( float fadelerp)

Definition at line 50 of file draw.qc.

51{
52 return 1.2 / (1.2 - fadelerp);
53}

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

◆ PolyDrawModel()

void PolyDrawModel ( entity e)

Definition at line 182 of file draw.qc.

183{
184 float i_s;
185 for(i_s = 0; ; ++i_s)
186 if(!PolyDrawModelSurface(e, i_s))
187 break;
188}
float PolyDrawModelSurface(entity e, float i_s)
Definition draw.qc:161

References entity(), and PolyDrawModelSurface().

Referenced by DrawDebugModel().

◆ PolyDrawModelSurface()

float PolyDrawModelSurface ( entity e,
float i_s )

Definition at line 161 of file draw.qc.

162{
163 float i_t;
164 float n_t;
165 vector tri;
166 string tex;
167 tex = getsurfacetexture(e, i_s);
168 if (!tex)
169 return 0; // this is beyond the last one
170 n_t = getsurfacenumtriangles(e, i_s);
171 for(i_t = 0; i_t < n_t; ++i_t)
172 {
173 tri = getsurfacetriangle(e, i_s, i_t);
174 R_BeginPolygon(tex, 0, false);
175 R_PolygonVertex(getsurfacepoint(e, i_s, tri.x), getsurfacepointattribute(e, i_s, tri.x, SPA_TEXCOORDS0), '1 1 1', 1);
176 R_PolygonVertex(getsurfacepoint(e, i_s, tri.y), getsurfacepointattribute(e, i_s, tri.y, SPA_TEXCOORDS0), '1 1 1', 1);
177 R_PolygonVertex(getsurfacepoint(e, i_s, tri.z), getsurfacepointattribute(e, i_s, tri.z, SPA_TEXCOORDS0), '1 1 1', 1);
178 R_EndPolygon();
179 }
180 return 1;
181}
#define SPA_TEXCOORDS0

References entity(), SPA_TEXCOORDS0, and vector.

Referenced by PolyDrawModel().

◆ stringwidth()

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

Definition at line 75 of file draw.qc.

76{
78 drawfontscale = '1 1 0';
79 float r = stringwidth_builtin(text, handleColors, sz);
80 drawfontscale = dfs;
81 return r;
82}

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