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

Function Item_SetScreenCoords

code/ui/ui_shared.cpp:5602–5641  ·  view source on GitHub ↗

=============== Item_SetScreenCoords =============== */

Source from the content-addressed store, hash-verified

5600===============
5601*/
5602void Item_SetScreenCoords(itemDef_t *item, float x, float y)
5603{
5604
5605 if (item == NULL)
5606 {
5607 return;
5608 }
5609
5610 if (item->window.border != 0)
5611 {
5612 x += item->window.borderSize;
5613 y += item->window.borderSize;
5614 }
5615
5616 item->window.rect.x = x + item->window.rectClient.x;
5617 item->window.rect.y = y + item->window.rectClient.y;
5618 item->window.rect.w = item->window.rectClient.w;
5619 item->window.rect.h = item->window.rectClient.h;
5620
5621 // force the text rects to recompute
5622 item->textRect.w = 0;
5623 item->textRect.h = 0;
5624
5625 switch ( item->type)
5626 {
5627 case ITEM_TYPE_TEXTSCROLL:
5628 {
5629 textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
5630 if ( scrollPtr )
5631 {
5632 scrollPtr->startPos = 0;
5633 scrollPtr->endPos = 0;
5634 }
5635
5636 Item_TextScroll_BuildLines ( item );
5637
5638 break;
5639 }
5640 }
5641}
5642
5643
5644static void Menu_FreeGhoulItems(menuDef_t *menu)

Callers 2

Menu_UpdatePositionFunction · 0.70
Item_UpdatePositionFunction · 0.70

Calls 1

Tested by

no test coverage detected