Skip to content

Commit

Permalink
Add RunnerParams.useImGuiTestEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Sep 27, 2023
1 parent 834c2cc commit f20ee48
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hello_imgui/internal/backend_impls/abstract_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ void AbstractRunner::LayoutSettings_Save()
void AbstractRunner::Setup()
{
#ifdef HELLOIMGUI_WITH_TEST_ENGINE
_AddTestEngineCallbacks(&this->params);
if (params.useImGuiTestEngine)
_AddTestEngineCallbacks(&this->params);
#endif

Impl_InitBackend();
Expand Down
12 changes: 12 additions & 0 deletions src/hello_imgui/runner_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ struct FpsIdling
Select the wanted backend type between `Sdl`, `Glfw` and `Qt`. Only useful when multiple backend are compiled
and available.
* `fpsIdling`: _FpsIdling_. Idling parameters (set fpsIdling.enableIdling to false to disable Idling)
* `useImGuiTestEngine`: _bool, default=false_.
Set this to true if you intend to use imgui_test_engine (please read note below)
* `iniFilename`: _string, default = ""_
Sets the ini filename under which imgui will save its params. Path is relative to the current app working dir.
If empty, then the ini file name will be derived from appWindowParams.windowTitle (if both are empty, the ini filename will be imgui.ini).
Expand All @@ -82,6 +84,13 @@ struct FpsIdling
shall not exit._
* `emscripten_fps`: _int, default = 0_.
Set the application refresh rate (only used on emscripten: 0 stands for "let the app or the browser decide")
Notes about the use of [Dear ImGui Test & Automation Engine](https://github.com/ocornut/imgui_test_engine):
* HelloImGui must be compiled with the option HELLOIMGUI_WITH_TEST_ENGINE (-DHELLOIMGUI_WITH_TEST_ENGINE=ON)
* See demo in src/hello_imgui_demos/hello_imgui_demo_test_engine.
* imgui_test_engine is subject to a [specific license](https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/LICENSE.txt)
TL;DR: free for individuals, educational, open-source and small businesses uses. Paid for larger businesses.
@@md
*/
struct RunnerParams
Expand All @@ -96,8 +105,11 @@ struct RunnerParams

BackendPointers backendPointers;
BackendType backendType = BackendType::FirstAvailable;

FpsIdling fpsIdling;

bool useImGuiTestEngine = false;

std::string iniFilename = "";
bool iniFilename_useAppWindowTitle = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ int main(int, char *[])
{
HelloImGui::RunnerParams runnerParams;
runnerParams.callbacks.ShowGui = Gui;
runnerParams.useImGuiTestEngine = true;

#ifdef HELLOIMGUI_WITH_TEST_ENGINE
runnerParams.callbacks.PostInit = [](){
Expand Down
4 changes: 4 additions & 0 deletions src/hello_imgui_test_engine_integration/todo_test.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
check uses of HELLOIMGUI_WITH_TEST_ENGINE vs IMGUI_ENABLE_TEST_ENGINE
HELLOIMGUI_WITH_TEST_ENGINE default ON or OFF ?
OFF dans HelloImGui ?
ON dans imGui Bundle ?


Config:
Study params
Expand Down

0 comments on commit f20ee48

Please sign in to comment.