4 #define draw_beginBoldFont() drawfont = FONT_USER + 2
5 #define draw_endBoldFont() drawfont = FONT_USER + 1
7 float expandingbox_sizefactor_from_fadelerp(float fadelerp);
9 vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor);
10 void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag);
12 void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag);
14 // The following functions / macros must be called from within
15 // the panel HUD / scoreboard code so that pos and size are scaled
16 // when the hud_dynamic code is running.
17 // Make use of stringwidth_builtin and draw*_builtin everywhere else.
19 float stringwidth(string text, float handleColors, vector sz);
21 #define drawpic(position, pic, size, rgb, alpha, flag) \
22 drawpic_builtin(HUD_Shift(position), pic, HUD_Scale(size), rgb, alpha, flag)
24 #define drawcharacter(position, character, scale, rgb, alpha, flag) \
25 drawcharacter_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
27 #define drawstring(position, text, scale, rgb, alpha, flag) \
28 drawstring_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
30 #define drawcolorcodedstring(position, text, scale, alpha, flag) \
31 drawcolorcodedstring_builtin(HUD_Shift(position), text, scale, alpha, flag)
33 #define drawcolorcodedstring2(position, text, scale, rgb, alpha, flag) \
34 drawcolorcodedstring2_builtin(HUD_Shift(position), text, scale, rgb, alpha, flag)
36 #define drawfill(position, size, rgb, alpha, flag) \
37 drawfill_builtin(HUD_Shift(position), HUD_Scale(size), rgb, alpha, flag)
39 #define drawsetcliparea(xposition, yposition, w, h) \
40 drawsetcliparea_builtin(HUD_ShiftX(xposition), HUD_ShiftY(yposition), HUD_ScaleX(w), HUD_ScaleY(h))
42 // Since drawsubpic usually gets called multiple times from within an
43 // utility function, instead of scaling pos and size in every call
44 // we scale them once for all in the beginning of that utility function.
45 // That's why drawsubpic isn't remapped.
47 #define drawsubpic(position, size, pic, srcPosition, srcSize, rgb, alpha, flag) \
48 drawsubpic_builtin(HUD_Shift(position), HUD_Scale(size), pic, HUD_Shift(srcPosition), HUD_Scale(srcSize), rgb, alpha, flag)
51 // drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
52 float _drawpic_imgaspect;
53 vector _drawpic_imgsize;
56 string _drawpic_picpath;
57 #define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
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;\
67 drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), pic, _drawpic_sz, color, theAlpha, drawflag);\
69 _drawpic_oldsz = _drawpic_sz.y;\
70 _drawpic_sz.y = _drawpic_sz.x / _drawpic_imgaspect;\
72 drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
77 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
78 #define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
80 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
81 if(precache_pic(_drawpic_picpath) == "") {\
82 _drawpic_picpath = strcat("gfx/hud/default/", pic);\
84 drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
85 _drawpic_picpath = string_null;\
88 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
89 #define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
91 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
92 if(precache_pic(_drawpic_picpath) == "") {\
93 _drawpic_picpath = strcat("gfx/hud/default/", pic);\
95 drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
96 _drawpic_picpath = string_null;\
99 void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
101 void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
103 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
104 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);
106 // drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box
107 void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag);
109 void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
111 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
112 void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp);
114 void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp);
116 void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp);
117 // this draws the triangles of a model DIRECTLY. Don't expect high performance, really...
118 float PolyDrawModelSurface(entity e, float i_s);
119 void PolyDrawModel(entity e);
121 void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector rgb, float a, float drawflag);