42void UI_DrawRect (
int x,
int y,
int w,
int h,
const vec4_t color,
float lineWidth,
int pattern)
44 R_DrawRect(x, y, w, h, color, lineWidth, pattern);
72 if (transform !=
nullptr) {
126void UI_DrawNormImage (
bool flip,
float x,
float y,
float w,
float h,
float sh,
float th,
float sl,
float tl,
const image_t* image)
128 float nw, nh, x1, x2, x3, x4, y1, y2, y3, y4;
151 nw = (sh - sl) *
viddef.rx;
163 nh = (th - tl) *
viddef.ry;
179 const float tmp = sl;
183 const vec2_t imageTexcoords[4] = {{sl, tl}, {sh, tl}, {sh, th}, {sl, th}};
184 const vec2_t imageVerts[4] = {{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}};
205 const struct image_s* image;
236 const int leftWidth = panelDef[0];
237 const int midWidth = panelDef[1];
238 const int rightWidth = panelDef[2];
239 const int topHeight = panelDef[3];
240 const int midHeight = panelDef[4];
241 const int bottomHeight = panelDef[5];
242 const int marge = panelDef[6];
245 const int firstPos = 0;
246 const int secondPos = firstPos + leftWidth + marge;
247 const int thirdPos = secondPos + midWidth + marge;
248 const int firstPosY = 0;
249 const int secondPosY = firstPosY + topHeight + marge;
250 const int thirdPosY = secondPosY + midHeight + marge;
253 UI_DrawNormImage(
false, pos[0], pos[1], leftWidth, topHeight, texX + firstPos + leftWidth, texY + firstPosY + topHeight,
254 texX + firstPos, texY + firstPosY, image);
255 UI_DrawNormImage(
false, pos[0] + leftWidth, pos[1],
size[0] - leftWidth - rightWidth, topHeight, texX + secondPos + midWidth, texY + firstPosY + topHeight,
256 texX + secondPos, texY + firstPosY, image);
257 UI_DrawNormImage(
false, pos[0] +
size[0] - rightWidth, pos[1], rightWidth, topHeight, texX + thirdPos + rightWidth, texY + firstPosY + topHeight,
258 texX + thirdPos, texY + firstPosY, image);
261 const int yMiddle = pos[1] + topHeight;
262 const int hMiddle =
size[1] - topHeight - bottomHeight;
263 UI_DrawNormImage(
false, pos[0], yMiddle, leftWidth, hMiddle, texX + firstPos + leftWidth, texY + secondPosY + midHeight,
264 texX + firstPos, texY + secondPosY, image);
265 UI_DrawNormImage(
false, pos[0] + leftWidth, yMiddle,
size[0] - leftWidth - rightWidth, hMiddle, texX + secondPos + midWidth, texY + secondPosY + midHeight,
266 texX + secondPos, texY + secondPosY, image);
267 UI_DrawNormImage(
false, pos[0] +
size[0] - rightWidth, yMiddle, rightWidth, hMiddle, texX + thirdPos + rightWidth, texY + secondPosY + midHeight,
268 texX + thirdPos, texY + secondPosY, image);
271 const int yBottom = pos[1] +
size[1] - bottomHeight;
272 UI_DrawNormImage(
false, pos[0], yBottom, leftWidth, bottomHeight, texX + firstPos + leftWidth, texY + thirdPosY + bottomHeight,
273 texX + firstPos, texY + thirdPosY, image);
274 UI_DrawNormImage(
false, pos[0] + leftWidth, yBottom,
size[0] - leftWidth - rightWidth, bottomHeight, texX + secondPos + midWidth, texY + thirdPosY + bottomHeight,
275 texX + secondPos, texY + thirdPosY, image);
276 UI_DrawNormImage(
false, pos[0] +
size[0] - bottomHeight, yBottom, rightWidth, bottomHeight, texX + thirdPos + rightWidth, texY + thirdPosY + bottomHeight,
277 texX + thirdPos, texY + thirdPosY, image);
299 const int leftWidth = border;
300 const int midWidth = texW - 2 * border;
301 const int rightWidth = border;
302 const int topHeight = border;
303 const int midHeight = texH - 2 * border;
304 const int bottomHeight = border;
307 const int firstPos = texX;
308 const int secondPos = firstPos + leftWidth + marge;
309 const int thirdPos = secondPos + midWidth + marge;
310 const int firstPosY = texY;
311 const int secondPosY = firstPosY + topHeight + marge;
312 const int thirdPosY = secondPosY + midHeight + marge;
315 UI_DrawNormImage(
false, pos[0], pos[1], leftWidth, topHeight, firstPos + leftWidth, firstPosY + topHeight,
316 firstPos, firstPosY, image);
317 UI_DrawNormImage(
false, pos[0] + leftWidth, pos[1],
size[0] - leftWidth - rightWidth, topHeight, secondPos + midWidth, firstPosY + topHeight,
318 secondPos, firstPosY, image);
319 UI_DrawNormImage(
false, pos[0] +
size[0] - rightWidth, pos[1], rightWidth, topHeight, thirdPos + rightWidth, firstPosY + topHeight,
320 thirdPos, firstPosY, image);
323 const int yMiddle = pos[1] + topHeight;
324 const int hMiddle =
size[1] - topHeight - bottomHeight;
325 UI_DrawNormImage(
false, pos[0], yMiddle, leftWidth, hMiddle, firstPos + leftWidth, secondPosY + midHeight,
326 firstPos, secondPosY, image);
327 UI_DrawNormImage(
false, pos[0] + leftWidth, yMiddle,
size[0] - leftWidth - rightWidth, hMiddle, secondPos + midWidth, secondPosY + midHeight,
328 secondPos, secondPosY, image);
329 UI_DrawNormImage(
false, pos[0] +
size[0] - rightWidth, yMiddle, rightWidth, hMiddle, thirdPos + rightWidth, secondPosY + midHeight,
330 thirdPos, secondPosY, image);
333 const int yBottom = pos[1] +
size[1] - bottomHeight;
334 UI_DrawNormImage(
false, pos[0], yBottom, leftWidth, bottomHeight, firstPos + leftWidth, thirdPosY + bottomHeight,
335 firstPos, thirdPosY, image);
336 UI_DrawNormImage(
false, pos[0] + leftWidth, yBottom,
size[0] - leftWidth - rightWidth, bottomHeight, secondPos + midWidth, thirdPosY + bottomHeight,
337 secondPos, thirdPosY, image);
338 UI_DrawNormImage(
false, pos[0] +
size[0] - bottomHeight, yBottom, rightWidth, bottomHeight, thirdPos + rightWidth, thirdPosY + bottomHeight,
339 thirdPos, thirdPosY, image);
365 const int xx = x + ((width * horizontalAlign) >> 1);
366 const int yy = y + ((height * verticalAlign) >> 1);
368 return UI_DrawString(fontID, align, xx, yy, xx, width, 0, text, 0, 0,
nullptr,
false, method);
372 int lineHeight,
const char* c,
int boxHeight,
int scrollPos,
int* curLine,
bool increaseLine,
longlines_t method)
387 if (verticalAlign == 1)
388 y += -(lineHeight / 2);
389 else if (verticalAlign == 2)
393 c, boxHeight, scrollPos, curLine, method);
395 if (curLine && increaseLine)
398 return lines * lineHeight;
410 color[3] = sin(
M_PI *
cls.realtime * speed / 500.0f) * 0.5f + 0.5f;
int R_FontDrawString(const char *fontId, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, longlines_t method)
Primary header for client.
void Com_Error(int code, const char *fmt,...)
void Com_Printf(const char *const fmt,...)
void R_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
void R_PushClipRect(int x, int y, int width, int height)
Force to draw only on a rect.
const image_t * R_DrawImageArray(const vec2_t texcoords[4], const vec2_t verts[4], const image_t *image)
void R_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
Draws a rect to the screen. Also has support for stippled rendering of the rect.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
void R_Transform(const vec3_t transform, const vec3_t rotate, const vec3_t scale)
Perform translate, rotate and scale operations on the current matrix.
void R_PopMatrix(void)
Removes the current matrix from the stack.
void R_PushMatrix(void)
Push a new matrix to the stack.
void R_TexOverride(vec4_t rgba)
Sets special texture environment mode to override texture color; don't forget to call R_TexOverride(n...
align_t
We need this here for checking the boundaries from script values.
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
int UI_FontGetHeight(const char *fontID)
const uiFont_t * UI_GetFontByID(const char *name)
Return the font for a specific id.
static const vec3_t scale
const struct image_s * UI_LoadWrappedImage(const char *name)
Searches for a wrapped image in the image array.
void UI_DrawPanel(const vec2_t pos, const vec2_t size, const char *texture, int texX, int texY, const int panelDef[7])
draw a panel from a texture as we can see on the image
void UI_DisableFlashing(void)
Disables flashing effect for UI nodes.
int UI_DrawString(const char *fontID, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, bool increaseLine, longlines_t method)
const struct image_s * UI_LoadImage(const char *name)
Searches for an image in the image array.
void UI_DrawBorderedPanel(const vec2_t pos, const vec2_t size, const char *texture, int texX, int texY, int texW, int texH, int border)
draw a panel from a texture as we can see on the image
int UI_DrawStringInBox(const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method)
draw a line into a bounding box
void UI_DrawRect(int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
const image_t * UI_DrawNormImageByName(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const char *name)
Draws an image or parts of it.
void UI_PushClipRect(int x, int y, int width, int height)
void UI_EnableFlashing(const vec4_t flashingColor, float speed)
Enables flashing effect for UI nodes.
void UI_Transform(const vec3_t transform, const vec3_t rotate, const vec3_t scale)
Pushes a new matrix, normalize to current resolution and move, rotate and scale the matrix to the giv...
void UI_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
void UI_DrawNormImage(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const image_t *image)
Draw a normalized (to the screen) image.
void UI_PopClipRect(void)
#define Vector4Copy(src, dest)
#define VectorCopy(src, dest)