Browse Source

Tests shell: Add single (non-blocking) render loop

Michael Ragazzon 2 months ago
parent
commit
8c77a51da7
2 changed files with 3 additions and 3 deletions
  1. 2 2
      Tests/Source/Common/TestsShell.cpp
  2. 1 1
      Tests/Source/Common/TestsShell.h

+ 2 - 2
Tests/Source/Common/TestsShell.cpp

@@ -141,7 +141,7 @@ void TestsShell::PresentFrame()
 		Backend::PresentFrame();
 		Backend::PresentFrame();
 }
 }
 
 
-void TestsShell::RenderLoop()
+void TestsShell::RenderLoop(bool block_until_escape)
 {
 {
 	REQUIRE(shell_context);
 	REQUIRE(shell_context);
 
 
@@ -150,7 +150,7 @@ void TestsShell::RenderLoop()
 		bool running = true;
 		bool running = true;
 		while (running)
 		while (running)
 		{
 		{
-			running = Backend::ProcessEvents(shell_context, &Shell::ProcessKeyDownShortcuts);
+			running = Backend::ProcessEvents(shell_context, &Shell::ProcessKeyDownShortcuts) && block_until_escape;
 			shell_context->Update();
 			shell_context->Update();
 			BeginFrame();
 			BeginFrame();
 			shell_context->Render();
 			shell_context->Render();

+ 1 - 1
Tests/Source/Common/TestsShell.h

@@ -47,7 +47,7 @@ void PresentFrame();
 // Render the current state of the context. Press 'escape' or 'return' to break out of the loop.
 // Render the current state of the context. Press 'escape' or 'return' to break out of the loop.
 // Useful for viewing documents while building the RML to benchmark.
 // Useful for viewing documents while building the RML to benchmark.
 // Applies only when compiled with the shell backend.
 // Applies only when compiled with the shell backend.
-void RenderLoop();
+void RenderLoop(bool block_until_escape = true);
 
 
 void ShutdownShell(bool reset_tests_render_interface = true);
 void ShutdownShell(bool reset_tests_render_interface = true);