MCPcopy Create free account
hub / github.com/ZDoom/Raze / Render

Method Render

source/common/startscreen/startscreen.cpp:662–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662void 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
706FImageSource* CreateStartScreenTexture(FBitmap& srcdata);
707

Callers 2

DisplayFunction · 0.45
RunEndoomFunction · 0.45

Calls 14

I_msTimeFunction · 0.85
DrawTextureFunction · 0.85
ClearClipRectMethod · 0.80
GetDisplayWidthMethod · 0.80
GetDisplayHeightMethod · 0.80
OnFrameDoneMethod · 0.80
I_GetEventFunction · 0.50
PalEntryClass · 0.50
BeginFrameMethod · 0.45
BeginMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected