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

Function _UI_Refresh

code/ui/ui_main.cpp:482–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480
481#define UI_FPS_FRAMES 4
482void _UI_Refresh( int realtime )
483{
484 static int index;
485 static int previousTimes[UI_FPS_FRAMES];
486
487 if ( !( Key_GetCatcher() & KEYCATCH_UI ) )
488 {
489 return;
490 }
491
492 extern void SE_CheckForLanguageUpdates(void);
493 SE_CheckForLanguageUpdates();
494
495 if ( Menus_AnyFullScreenVisible() )
496 {//if not in full screen, don't mess with ghoul2
497 //rww - ghoul2 needs to know what time it is even if the client/server are not running
498 //FIXME: this screws up the game when you go back to the game...
499 re.G2API_SetTime(realtime, 0);
500 re.G2API_SetTime(realtime, 1);
501 }
502
503 uiInfo.uiDC.frameTime = realtime - uiInfo.uiDC.realTime;
504 uiInfo.uiDC.realTime = realtime;
505
506 previousTimes[index % UI_FPS_FRAMES] = uiInfo.uiDC.frameTime;
507 index++;
508 if ( index > UI_FPS_FRAMES )
509 {
510 int i, total;
511 // average multiple frames together to smooth changes out a bit
512 total = 0;
513 for ( i = 0 ; i < UI_FPS_FRAMES ; i++ )
514 {
515 total += previousTimes[i];
516 }
517 if ( !total )
518 {
519 total = 1;
520 }
521 uiInfo.uiDC.FPS = 1000 * UI_FPS_FRAMES / total;
522 }
523
524 UI_UpdateCvars();
525
526 if (Menu_Count() > 0)
527 {
528 // paint all the menus
529 Menu_PaintAll();
530 // refresh server browser list
531// UI_DoServerRefresh();
532 // refresh server status
533// UI_BuildServerStatus(qfalse);
534 // refresh find player list
535// UI_BuildFindPlayerList(qfalse);
536 }
537
538 // draw cursor
539 UI_SetColor( NULL );

Callers 1

SCR_DrawScreenFieldFunction · 0.85

Calls 8

UI_UpdateCvarsFunction · 0.70
Menu_CountFunction · 0.70
Menu_PaintAllFunction · 0.70
UI_SetColorFunction · 0.70
UI_DrawHandlePicFunction · 0.70
Key_GetCatcherFunction · 0.50

Tested by

no test coverage detected