MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / Run

Method Run

deps/LLGL/examples/Cpp/ExampleBase/ExampleBase.cpp:203–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201#endif
202
203void ExampleBase::Run()
204{
205 LLGL::Extent2D resolution = context->GetResolution();
206 bool showTimeRecords = false;
207
208 while (context->GetSurface().ProcessEvents() && !input->KeyDown(LLGL::Key::Escape))
209 {
210 // Update profiler (if debugging is enabled)
211 if (debuggerObj_)
212 {
213 if (showTimeRecords)
214 {
215 std::cout << "\n";
216 std::cout << "FRAME TIME RECORDS:\n";
217 std::cout << "-------------------\n";
218 for (const auto& rec : profilerObj_->frameProfile.timeRecords)
219 std::cout << rec.annotation << ": " << rec.elapsedTime << " ns\n";
220
221 profilerObj_->timeRecordingEnabled = false;
222 showTimeRecords = false;
223 }
224 else if (input->KeyDown(LLGL::Key::F1))
225 {
226 profilerObj_->timeRecordingEnabled = true;
227 showTimeRecords = true;
228 }
229 profilerObj_->NextProfile();
230 }
231
232 // Draw current frame
233 #ifdef LLGL_OS_MACOS
234 @autoreleasepool
235 {
236 OnDrawFrame();
237 }
238 #else
239 OnDrawFrame();
240 #endif
241
242 // Check if resolution has changed
243 auto currentResolution = context->GetResolution();
244 if (resolution != currentResolution)
245 {
246 OnResize(currentResolution);
247 resolution = currentResolution;
248 }
249 }
250}
251
252ExampleBase::ExampleBase(
253 const std::wstring& title,

Callers 1

RunExampleFunction · 0.45

Calls 6

OnDrawFrameFunction · 0.85
GetSurfaceMethod · 0.80
KeyDownMethod · 0.80
GetResolutionMethod · 0.45
ProcessEventsMethod · 0.45
NextProfileMethod · 0.45

Tested by

no test coverage detected