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 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)
bool draw_PictureExists (string pic)
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 ( )
Value:
float FONT_USER
Definition main.qh:48
float drawfont

Definition at line 12 of file draw.qh.

◆ draw_endBoldFont

#define draw_endBoldFont ( )
Value:

Definition at line 13 of file draw.qh.

◆ draw_fontscale

Function Documentation

◆ boxToGlobal()

◆ boxToGlobalSize()

◆ draw_BorderPicture()

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

Definition at line 44 of file draw.qh.

45 {
46 if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
47 {
48 drawpic_builtin(theOrigin, pic, theSize, theColor, theAlpha, 0);
49 return;
50 }
51 if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
52 {
53 // draw only the central part
54 drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
55 return;
56 }
57
58 vector dX, dY;
59 vector width, height;
60 vector bW, bH;
61 // pic = draw_UseSkinFor(pic);
62 width = eX * theSize.x;
63 height = eY * theSize.y;
64 if (theSize.x <= theBorderSize.x * 2)
65 {
66 // not wide enough... draw just left and right then
67 bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
68 if (theSize.y <= theBorderSize.y * 2)
69 {
70 // not high enough... draw just corners
71 bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
72 drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
73 drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
74 drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
75 drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
76 }
77 else
78 {
79 dY = theBorderSize.x * eY;
80 drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
81 drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
82 drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
83 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);
84 drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
85 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);
86 }
87 }
88 else
89 {
90 if (theSize.y <= theBorderSize.y * 2)
91 {
92 // not high enough... draw just top and bottom then
93 bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
94 dX = theBorderSize.x * eX;
95 drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
96 drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
97 drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
98 drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
99 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);
100 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);
101 }
102 else
103 {
104 dX = theBorderSize.x * eX;
105 dY = theBorderSize.x * eY;
106 drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
107 drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
108 drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
109 drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
110 drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
111 drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
112 drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
113 drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
114 drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
115 }
116 }
117 }
float height
Definition bobbing.qc:3
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
vector
Definition self.qh:92
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44

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

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

◆ draw_ButtonPicture()

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

Definition at line 108 of file draw.qc.

109{
110 vector square;
111 vector width, height;
112 vector bW;
113 pic = draw_UseSkinFor(pic);
114 theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
115 theSize = boxToGlobalSize(theSize, draw_scale);
116 theAlpha *= draw_alpha;
117 width = eX * theSize.x;
118 height = eY * theSize.y;
119 if(theSize.x <= theSize.y * 2)
120 {
121 // button not wide enough
122 // draw just left and right part then
123 square = eX * theSize.x * 0.5;
124 bW = eX * (0.25 * theSize.x / (theSize.y * 2));
125 drawsubpic(theOrigin, square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, 0);
126 drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, 0);
127 }
128 else
129 {
130 square = eX * theSize.y;
131 drawsubpic(theOrigin, height + square, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, 0);
132 drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0.25 0 0', '0.5 1 0', theColor, theAlpha, 0);
133 drawsubpic(theOrigin + width - square, height + square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0);
134 }
135}
vector boxToGlobalSize(vector v, vector theScale)
Definition draw.qc:53
vector boxToGlobal(vector v, vector theOrigin, vector theScale)
Definition draw.qc:45
vector draw_shift
Definition draw.qh:7
vector draw_scale
Definition draw.qh:8
float draw_alpha
Definition draw.qh:9

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

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

◆ draw_CenterText()

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

Definition at line 298 of file draw.qc.

299{
300 //dprint(strcat("orig = ", vtos(theOrigin) ," tx = ", ftos(draw_TextWidth(theText, ICanHasKallerz, theSize)), "\n"));
301 draw_Text(theOrigin - eX * 0.5 * draw_TextWidth(theText, ICanHasKallerz, theSize), theText, theSize, theColor, theAlpha, ICanHasKallerz);
302}
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:282
float draw_TextWidth(string theText, float ICanHasKallerz, vector SizeThxBye)
Definition draw.qc:304

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

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

◆ draw_ClearClip()

void draw_ClearClip ( )

Definition at line 362 of file draw.qc.

363{
364 if (IL_EMPTY(draw_clip)) {
365 LOG_FATAL("Not clipping, can't clear it then");
366 }
367 entity currentSettings = IL_PEEK(draw_clip);
368 IL_REMOVE(draw_clip, currentSettings);
369 delete(currentSettings);
372 if (e) {
374 }
375}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector clip_scale
Definition draw.qc:330
vector clip_shift
Definition draw.qc:329
#define drawsetcliparea(xposition, yposition, w, h)
Definition draw.qh:39
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
#define IL_PEEK(this)
#define IL_EMPTY(this)
#define LOG_FATAL(...)
Definition log.qh:53
IntrusiveList draw_clip
Definition draw.qc:326
void drawresetcliparea(void)

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

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

◆ draw_CondensedFontFactor()

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

Definition at line 316 of file draw.qc.

317{
318 float w = draw_TextWidth(theText, ICanHasKallerz, SizeThxBye);
319 if (w > maxWidth) {
320 //dprintf("NOTE: label text %s too wide for label, condensed by factor %f\n", theText, maxWidth / w);
321 return maxWidth / w;
322 }
323 return 1.0;
324}

References draw_TextWidth(), and vector.

Referenced by XonoticGametypeList_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticTopicList_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

◆ draw_drawMousePointer()

void draw_drawMousePointer ( vector where)

Definition at line 16 of file draw.qc.

17{
19}
#define drawpic(position, pic, size, rgb, alpha, flag)
Definition draw.qh:21
vector draw_mousepointer_size
Definition draw.qc:7
string draw_mousepointer
Definition draw.qc:5
vector draw_mousepointer_offset
Definition draw.qc:6

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

Referenced by m_draw().

◆ draw_Fill()

◆ draw_Picture()

◆ draw_PictureExists()

bool draw_PictureExists ( string pic)

Definition at line 86 of file draw.qc.

87{
88 pic = draw_UseSkinFor(pic);
89 if (fexists(strcat(pic, ".tga"))) return true;
90 if (fexists(strcat(pic, ".png"))) return true;
91 if (fexists(strcat(pic, ".jpg"))) return true;
92 if (fexists(strcat(pic, ".pcx"))) return true;
93
94 return false;
95}
ERASEABLE bool fexists(string f)
Definition file.qh:4
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References fexists(), and strcat().

Referenced by XonoticMapInfoDialog_loadMapInfo().

◆ draw_PictureSize()

◆ draw_PreloadPicture()

string draw_PreloadPicture ( string pic)

Definition at line 60 of file draw.qc.

61{
62 pic = draw_UseSkinFor(pic);
63 return precache_pic(pic);
64}
string precache_pic(string name,...)

References precache_pic().

Referenced by XonoticCrosshairPicker_configureXonoticCrosshairPicker(), XonoticEntryList_drawListBoxItem(), XonoticEntryList_refilter(), XonoticMapList_refilter(), and XonoticServerList_drawListBoxItem().

◆ draw_PreloadPictureWithFlags()

string draw_PreloadPictureWithFlags ( string pic,
float f )

Definition at line 66 of file draw.qc.

67{
68 pic = draw_UseSkinFor(pic);
69 return precache_pic(pic, f);
70}

References precache_pic().

Referenced by XonoticGametypeList_configureXonoticGametypeList().

◆ draw_reset()

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

Definition at line 21 of file draw.qc.

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
#define draw_fontscale
Definition draw.qh:5

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

Referenced by draw_reset_cropped(), and draw_reset_full().

◆ draw_SetClip()

void draw_SetClip ( )

Definition at line 349 of file draw.qc.

350{
352}
void _draw_SetClip(vector o, vector s)
Definition draw.qc:333

References _draw_SetClip(), draw_scale, and draw_shift.

Referenced by Image_draw(), and ListBox_draw().

◆ draw_SetClipRect()

void draw_SetClipRect ( vector theOrigin,
vector theScale )

Definition at line 354 of file draw.qc.

355{
357 boxToGlobal(theOrigin, draw_shift, draw_scale),
358 boxToGlobalSize(theScale, draw_scale)
359 );
360}

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

Referenced by InputBox_draw().

◆ draw_setMousePointer()

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

Definition at line 9 of file draw.qc.

10{
11 draw_mousepointer = strzone(draw_UseSkinFor(pic));
12 draw_mousepointer_size = theSize;
13 draw_mousepointer_offset = eX * (theOffset.x * theSize.x) + eY * (theOffset.y * theSize.y);
14}
string strzone(string s)

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

Referenced by m_init_delayed().

◆ draw_Text()

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

Definition at line 282 of file draw.qc.

283{
284 if(theSize.x <= 0 || theSize.y <= 0) {
285 LOG_TRACE("Drawing zero size text?");
286 return;
287 }
288
289 //float wi;
290 //wi = draw_TextWidth(theText, ICanHasKallerz, theSize);
291 //draw_Fill(theOrigin, '1 0 0' * wi + '0 1 0' * theSize_y, '1 0 0', 0.3);
292
293 if(ICanHasKallerz)
295 else
296 drawstring(boxToGlobal(theOrigin, draw_shift, draw_scale), theText, globalToBoxSize(boxToGlobalSize(theSize, draw_scale), draw_fontscale), theColor, theAlpha * draw_alpha, 0);
297}
#define drawcolorcodedstring(position, text, scale, alpha, flag)
Definition draw.qh:30
#define drawstring(position, text, scale, rgb, alpha, flag)
Definition draw.qh:27
#define LOG_TRACE(...)
Definition log.qh:76
vector globalToBoxSize(vector v, vector theScale)
Definition draw.qc:38

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

Referenced by draw_CenterText(), XonoticRegisteredSettingsList::drawListBoxItem(), InputBox_draw(), Label_draw(), ListBox_drawListBoxItem(), m_tooltip(), XonoticCampaignList_drawListBoxItem(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticEntryList_drawListBoxItem(), XonoticGametypeList_drawListBoxItem(), XonoticGuideDescription_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticLanguageList_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPlayerList_drawListBoxItem(), XonoticPlayList_drawListBoxItem(), XonoticScreenshotImage_draw(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), XonoticStatsList_drawListBoxItem(), XonoticTextBox_drawListBoxItem(), XonoticTopicList_drawListBoxItem(), and XonoticWeaponsList_drawListBoxItem().

◆ draw_TextLengthUpToWidth()

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

Definition at line 401 of file draw.qc.

402{
403 if(allowColorCodes)
404 return textLengthUpToWidth(theText, maxWidth, theFontSize, draw_TextWidth_WithColors);
405 else
406 return textLengthUpToWidth(theText, maxWidth, theFontSize, draw_TextWidth_WithoutColors);
407}
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
Definition util.qc:888
float draw_TextWidth_WithoutColors(string s, vector theFontSize)
Definition draw.qc:396
float draw_TextWidth_WithColors(string s, vector theFontSize)
Definition draw.qc:391

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

Referenced by InputBox_mouseDrag().

◆ draw_TextShortenToWidth()

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

Definition at line 377 of file draw.qc.

378{
379 /*
380 if(draw_TextWidth(theText, ICanHasKallerz, SizeThxBye) <= maxWidth)
381 return theText;
382 else
383 return strcat(substring(theText, 0, draw_TextLengthUpToWidth(theText, maxWidth - draw_TextWidth("...", ICanHasKallerz, SizeThxBye), ICanHasKallerz, SizeThxBye)), "...");
384 */
385 if(ICanHasKallerz)
386 return textShortenToWidth(theText, maxWidth, SizeThxBye, draw_TextWidth_WithColors);
387 else
388 return textShortenToWidth(theText, maxWidth, SizeThxBye, draw_TextWidth_WithoutColors);
389}
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
Definition util.qc:1071

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

Referenced by XonoticRegisteredSettingsList::drawListBoxItem(), Label_draw(), XonoticCampaignList_drawListBoxItem(), XonoticCvarList_drawListBoxItem(), XonoticDemoList_drawListBoxItem(), XonoticEntryList_drawListBoxItem(), XonoticHUDSkinList_drawListBoxItem(), XonoticKeyBinder_drawListBoxItem(), XonoticMapList_drawListBoxItem(), XonoticPlayerList_drawListBoxItem(), XonoticPlayList_drawListBoxItem(), XonoticScreenshotList_drawListBoxItem(), XonoticServerList_drawListBoxItem(), XonoticSkinList_drawListBoxItem(), XonoticSoundList_drawListBoxItem(), and XonoticStatsList_drawListBoxItem().

◆ draw_TextWidth()

◆ draw_TextWidth_WithColors()

float draw_TextWidth_WithColors ( string s,
vector size )

Definition at line 391 of file draw.qc.

392{
393 return draw_TextWidth(s, true, theFontSize);
394}

References draw_TextWidth(), and vector.

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

◆ draw_TextWidth_WithoutColors()

float draw_TextWidth_WithoutColors ( string s,
vector size )

◆ draw_VertButtonPicture()

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

Definition at line 143 of file draw.qc.

144{
145 vector square;
146 vector width, height;
147 vector bH;
148 pic = draw_UseSkinFor(pic);
149 theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
150 theSize = boxToGlobalSize(theSize, draw_scale);
151 theAlpha *= draw_alpha;
152 width = eX * theSize.x;
153 height = eY * theSize.y;
154 if(theSize.y <= theSize.x * 2)
155 {
156 // button not high enough
157 // draw just upper and lower part then
158 square = eY * theSize.y * 0.5;
159 bH = eY * (0.25 * theSize.y / (theSize.x * 2));
160 drawsubpic(theOrigin, square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, 0);
161 drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, 0);
162 }
163 else
164 {
165 square = eY * theSize.x;
166 drawsubpic(theOrigin, width + square, pic, '0 0 0', '1 0.25 0', theColor, theAlpha, 0);
167 drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5 0', theColor, theAlpha, 0);
168 drawsubpic(theOrigin + height - square, width + square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, 0);
169 }
170}

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

Referenced by ListBox_draw().

◆ globalToBox()

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

Definition at line 30 of file draw.qc.

31{
32 v -= theOrigin;
33 v.x /= theScale.x;
34 v.y /= theScale.y;
35 return v;
36}

References vector.

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

◆ globalToBoxSize()

vector globalToBoxSize ( vector v,
vector scale )

Variable Documentation

◆ draw_alpha

◆ draw_scale

◆ draw_shift

◆ drawfontscale

vector drawfontscale

Definition at line 4 of file draw.qh.