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 183 of file draw.qc.

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

115 {
116 DRAWSTRING_ASPECT_SCALE(pos, text, sz, true);
117 drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag);
118}
#define DRAWSTRING_ASPECT_SCALE(pos, text, sz, allow_colors)
Definition draw.qc:87
#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 152 of file draw.qc.

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

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 142 of file draw.qc.

143{
144 float sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
145
147 // eventually replace with drawcolorcodedstring
148 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);
150}
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 = expandingbox_sizefactor_from_fadelerp(fadelerp);
64
65 drawpic_aspect_skin(position + expandingbox_resize_centered_box_offset(sz, theScale, 1), pic, theScale * sz, rgb, theAlpha * (1 - fadelerp), flag);
66}
#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 68 of file draw.qc.

69{
70 drawpic_aspect_skin_expanding(position, pic, theScale, rgb, theAlpha, flag, fadelerp);
71 drawpic_skin(position, pic, theScale, rgb, theAlpha * fadelerp, flag);
72}
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 109 of file draw.qc.

109 {
110 DRAWSTRING_ASPECT_SCALE(pos, text, sz, false);
111 drawstring(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag);
112}
#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 137 of file draw.qc.

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

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 120 of file draw.qc.

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

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 176 of file draw.qc.

177{
178 for(int i_s = 0; ; ++i_s)
179 if(!PolyDrawModelSurface(e, i_s))
180 break;
181}
float PolyDrawModelSurface(entity e, float i_s)
Definition draw.qc:158

References entity(), and PolyDrawModelSurface().

Referenced by DrawDebugModel().

◆ PolyDrawModelSurface()

float PolyDrawModelSurface ( entity e,
float i_s )

Definition at line 158 of file draw.qc.

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

References entity(), SPA_TEXCOORDS0, and vector.

Referenced by PolyDrawModel().

◆ stringwidth()

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

Definition at line 74 of file draw.qc.

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

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