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

Function Item_TextScroll_ThumbPosition

code/ui/ui_shared.cpp:7532–7552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7530}
7531
7532int Item_TextScroll_ThumbPosition ( itemDef_t *item )
7533{
7534 float max, pos, size;
7535 textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
7536
7537 max = Item_TextScroll_MaxScroll ( item );
7538 size = item->window.rect.h - (SCROLLBAR_SIZE * 2) - 2;
7539
7540 if (max > 0)
7541 {
7542 pos = (size-SCROLLBAR_SIZE) / (float) max;
7543 }
7544 else
7545 {
7546 pos = 0;
7547 }
7548
7549 pos *= scrollPtr->startPos;
7550
7551 return item->window.rect.y + 1 + SCROLLBAR_SIZE + pos;
7552}
7553
7554int Item_TextScroll_ThumbDrawPosition ( itemDef_t *item )
7555{

Callers 2

Item_TextScroll_OverLBFunction · 0.70

Calls 1

Tested by

no test coverage detected