| 660 | } |
| 661 | |
| 662 | void FStartScreen::Render(bool force) |
| 663 | { |
| 664 | static uint64_t minwaittime = 30; |
| 665 | |
| 666 | auto nowtime = I_msTime(); |
| 667 | // Do not refresh too often. This function gets called a lot more frequently than the screen can update. |
| 668 | if (nowtime - screen->FrameTime > minwaittime || force) |
| 669 | { |
| 670 | screen->FrameTime = nowtime; |
| 671 | screen->BeginFrame(); |
| 672 | twod->ClearClipRect(); |
| 673 | I_GetEvent(); |
| 674 | ValidateTexture(); |
| 675 | float displaywidth; |
| 676 | float displayheight; |
| 677 | twod->Begin(screen->GetWidth(), screen->GetHeight()); |
| 678 | |
| 679 | // At this point the shader for untextured rendering has not been loaded yet, so we got to clear the screen by rendering a texture with black color. |
| 680 | DrawTexture(twod, StartupTexture, 0, 0, DTA_VirtualWidthF, StartupTexture->GetDisplayWidth(), DTA_VirtualHeightF, StartupTexture->GetDisplayHeight(), DTA_KeepRatio, true, DTA_Color, PalEntry(255,0,0,0), TAG_END); |
| 681 | |
| 682 | if (HeaderTexture) |
| 683 | { |
| 684 | displaywidth = HeaderTexture->GetDisplayWidth(); |
| 685 | displayheight = HeaderTexture->GetDisplayHeight() + StartupTexture->GetDisplayHeight(); |
| 686 | DrawTexture(twod, HeaderTexture, 0, 0, DTA_VirtualWidthF, displaywidth, DTA_VirtualHeightF, displayheight, TAG_END); |
| 687 | DrawTexture(twod, StartupTexture, 0, 32, DTA_VirtualWidthF, displaywidth, DTA_VirtualHeightF, displayheight, TAG_END); |
| 688 | if (NetMaxPos >= 0) DrawTexture(twod, NetTexture, 0, displayheight - 16, DTA_VirtualWidthF, displaywidth, DTA_VirtualHeightF, displayheight, TAG_END); |
| 689 | } |
| 690 | else |
| 691 | { |
| 692 | displaywidth = StartupTexture->GetDisplayWidth(); |
| 693 | displayheight = StartupTexture->GetDisplayHeight(); |
| 694 | DrawTexture(twod, StartupTexture, 0, 0, DTA_VirtualWidthF, displaywidth, DTA_VirtualHeightF, displayheight, TAG_END); |
| 695 | } |
| 696 | |
| 697 | twod->End(); |
| 698 | screen->Update(); |
| 699 | twod->OnFrameDone(); |
| 700 | } |
| 701 | auto newtime = I_msTime(); |
| 702 | if ((newtime - nowtime) * 2 > minwaittime) // slow down drawing the start screen if we're on a slow GPU! |
| 703 | minwaittime = (newtime - nowtime) * 2; |
| 704 | } |
| 705 | |
| 706 | FImageSource* CreateStartScreenTexture(FBitmap& srcdata); |
| 707 |
no test coverage detected