MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / render

Method render

game/ui/general/videoscreen.cpp:88–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void VideoScreen::render()
89{
90 if (this->video)
91 {
92 auto time_now = std::chrono::high_resolution_clock::now();
93 auto time_since_last_frame = time_now - this->last_frame_time;
94 while (time_since_last_frame >= this->video->getFrameTime())
95 {
96 this->last_frame_time += video->getFrameTime();
97 this->current_frame = this->video->popImage();
98
99 if (!this->current_frame)
100 {
101 // End of video
102 this->video = nullptr;
103 break;
104 }
105 time_since_last_frame = time_now - this->last_frame_time;
106 }
107 }
108 if (this->current_frame)
109 {
110 if (this->current_frame->palette)
111 fw().renderer->setPalette(this->current_frame->palette);
112 fw().renderer->drawScaled(this->current_frame->image, this->frame_position,
113 this->frame_size, Renderer::Scaler::Nearest);
114 }
115}
116
117bool VideoScreen::isTransition() { return false; }
118

Callers

nothing calls this directly

Calls 4

getFrameTimeMethod · 0.80
popImageMethod · 0.80
setPaletteMethod · 0.45
drawScaledMethod · 0.45

Tested by

no test coverage detected