MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Window_Paint

Function Window_Paint

code/ui/ui_shared.cpp:8452–8564  ·  view source on GitHub ↗

================= Window_Paint ================= */

Source from the content-addressed store, hash-verified

8450=================
8451*/
8452void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle)
8453{
8454 //float bordersize = 0;
8455 vec4_t color;
8456 rectDef_t fillRect = w->rect;
8457
8458 if (uis.debugMode)
8459 {
8460 color[0] = color[1] = color[2] = color[3] = 1;
8461 DC->drawRect(w->rect.x, w->rect.y, w->rect.w, w->rect.h, 1, color);
8462 }
8463
8464 if (w == NULL || (w->style == 0 && w->border == 0))
8465 {
8466 return;
8467 }
8468
8469 if (w->border != 0)
8470 {
8471 fillRect.x += w->borderSize;
8472 fillRect.y += w->borderSize;
8473 fillRect.w -= w->borderSize + 1;
8474 fillRect.h -= w->borderSize + 1;
8475 }
8476
8477 if (w->style == WINDOW_STYLE_FILLED)
8478 {
8479 // box, but possible a shader that needs filled
8480 if (w->background)
8481 {
8482 Fade(&w->flags, &w->backColor[3], fadeClamp, &w->nextTime, fadeCycle, qtrue, fadeAmount);
8483 DC->setColor(w->backColor);
8484 DC->drawHandlePic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->background);
8485 DC->setColor(NULL);
8486 }
8487 else
8488 {
8489 DC->fillRect(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->backColor);
8490 }
8491 }
8492 else if (w->style == WINDOW_STYLE_GRADIENT)
8493 {
8494 GradientBar_Paint(&fillRect, w->backColor);
8495 // gradient bar
8496 }
8497 else if (w->style == WINDOW_STYLE_SHADER)
8498 {
8499 if (w->flags & WINDOW_PLAYERCOLOR)
8500 {
8501 vec4_t color;
8502 color[0] = ui_char_color_red.integer/255.0f;
8503 color[1] = ui_char_color_green.integer/255.0f;
8504 color[2] = ui_char_color_blue.integer/255.0f;
8505 color[3] = 1;
8506 ui.R_SetColor(color);
8507 }
8508 else if (w->flags & WINDOW_FORECOLORSET)
8509 {

Callers 2

Menu_PaintFunction · 0.70
Item_PaintFunction · 0.70

Calls 2

FadeFunction · 0.70
GradientBar_PaintFunction · 0.70

Tested by

no test coverage detected