diff --git a/CMakeLists.txt b/CMakeLists.txt index df37b6be..04eb4066 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,8 +52,8 @@ option(HELLOIMGUI_ADD_APP_WITH_INSTALL "Add cmake install() instructions with he # # Note: # - Only one rendering backend can be used at a time (OpenGL3, Metal or Vulkan)! -# - You may select multiple windowing backends (for example, you may select both SDL and Glfw3) -# - Backends using OpenGL3 as a renderer are easier to use, and are recommended, especially for beginners. +# - You may select multiple platform backends (for example, you may select both SDL and Glfw3) +# - Combinations using OpenGL3 as a renderer are easier to use, and are recommended, especially for beginners. #------------------------------------------------------------------------------ # Standard backends: # Use Glfw3 + OpenGl3 diff --git a/hello_imgui_cmake/hello_imgui_build_lib.cmake b/hello_imgui_cmake/hello_imgui_build_lib.cmake index 63850c08..635062d4 100644 --- a/hello_imgui_cmake/hello_imgui_build_lib.cmake +++ b/hello_imgui_cmake/hello_imgui_build_lib.cmake @@ -438,7 +438,7 @@ endfunction() ################################################################################################### -# SDL Windowing backend: API = him_use_sdl2_backend +# SDL platform backend: API = him_use_sdl2_backend ################################################################################################### function (him_use_sdl2_backend target) _him_fetch_sdl_if_needed() @@ -538,7 +538,7 @@ endfunction() ################################################################################################### -# Glfw Windowing backend: API = him_use_glfw_backend +# Glfw platform backend: API = him_use_glfw_backend ################################################################################################### function(him_use_glfw_backend target) _him_fetch_glfw_if_needed() diff --git a/src/hello_imgui/hello_imgui_api.md b/src/hello_imgui/hello_imgui_api.md index b826e67f..535ef98d 100644 --- a/src/hello_imgui/hello_imgui_api.md +++ b/src/hello_imgui/hello_imgui_api.md @@ -132,7 +132,7 @@ int main(){ A struct that contains optional pointers to the backend implementations. These pointers will be filled when the application starts * `backendType`: _enum BackendType, default=BackendType::FirstAvailable_ - Select the wanted Windowing backend type between `Sdl`, `Glfw`. Only useful when multiple backend are compiled + Select the wanted platform backend type between `Sdl`, `Glfw`. 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_. diff --git a/src/hello_imgui/internal/backend_impls/abstract_runner.cpp b/src/hello_imgui/internal/backend_impls/abstract_runner.cpp index 49e12776..2eb31eac 100644 --- a/src/hello_imgui/internal/backend_impls/abstract_runner.cpp +++ b/src/hello_imgui/internal/backend_impls/abstract_runner.cpp @@ -39,7 +39,7 @@ // // NOTE: AbstractRunner should *not* care in any case of: -// - the Windowing backend (SDL, Glfw, ...) +// - the platform backend (SDL, Glfw, ...) // - the rendering backend (OpenGL, Metal, ...) // For legacy reasons, there are still few references to OpenGL in this file, but this needs to be refactored out. // @@ -410,8 +410,8 @@ void AbstractRunner::Setup() InitImGuiContext(); SetImGuiPrefs(); - // Init Windowing backend (SDL, Glfw) - Impl_InitBackend(); + // Init platform backend (SDL, Glfw) + Impl_InitPlatformBackend(); #ifdef HELLOIMGUI_HAS_OPENGL Impl_Select_Gl_Version(); @@ -427,14 +427,14 @@ void AbstractRunner::Setup() Impl_SetWindowIcon(); - // This should be done before Impl_LinkWindowingToRenderingBackend() + // This should be done before Impl_LinkPlatformAndRenderBackends() // because, in the case of glfw ImGui_ImplGlfw_InstallCallbacks // will chain the user callbacks with ImGui callbacks; and PostInit() // is a good place for the user to install callbacks if (params.callbacks.PostInit) params.callbacks.PostInit(); - Impl_LinkWindowingToRenderingBackend(); + Impl_LinkPlatformAndRenderBackends(); params.callbacks.SetupImGuiConfig(); params.callbacks.SetupImGuiStyle(); diff --git a/src/hello_imgui/internal/backend_impls/abstract_runner.h b/src/hello_imgui/internal/backend_impls/abstract_runner.h index a16c19ce..e7bad20b 100644 --- a/src/hello_imgui/internal/backend_impls/abstract_runner.h +++ b/src/hello_imgui/internal/backend_impls/abstract_runner.h @@ -62,9 +62,9 @@ class AbstractRunner // // - // Methods related to the Windowing backend (SDL, Glfw, ...) + // Methods related to the platform backend (SDL, Glfw, ...) // - virtual void Impl_InitBackend() = 0; + virtual void Impl_InitPlatformBackend() = 0; virtual void Impl_CreateWindow() = 0; virtual void Impl_PollEvents() = 0; virtual void Impl_NewFrame_Backend() = 0; @@ -74,9 +74,9 @@ class AbstractRunner virtual void Impl_SetWindowIcon() {} // - // Linking the windowing backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) + // Linking the platform backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) // - virtual void Impl_LinkWindowingToRenderingBackend() = 0; + virtual void Impl_LinkPlatformAndRenderBackends() = 0; // Specific to OpenGL #ifdef HELLOIMGUI_HAS_OPENGL virtual void Impl_Select_Gl_Version() = 0; diff --git a/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.cpp b/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.cpp index 00dd957e..fb4a440d 100644 --- a/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.cpp +++ b/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.cpp @@ -136,7 +136,7 @@ void RunnerQt::RunQGuiApplication() } -void RunnerQt::Impl_InitBackend() +void RunnerQt::Impl_InitPlatformBackend() { } diff --git a/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.h b/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.h index 68d19c07..6d0e4008 100644 --- a/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.h +++ b/src/hello_imgui/internal/backend_impls/deprecated/runner_qt.h @@ -18,7 +18,7 @@ class RunnerQt : public AbstractRunner void RunQGuiApplication(); protected: - void Impl_InitBackend() override; + void Impl_InitPlatformBackend() override; void Impl_Select_Gl_Version() override; std::string Impl_GlslVersion() override; void Impl_CreateWindow() override; diff --git a/src/hello_imgui/internal/backend_impls/rendering_callbacks.h b/src/hello_imgui/internal/backend_impls/rendering_callbacks.h index 7b5e7be6..56f24539 100644 --- a/src/hello_imgui/internal/backend_impls/rendering_callbacks.h +++ b/src/hello_imgui/internal/backend_impls/rendering_callbacks.h @@ -18,14 +18,14 @@ namespace HelloImGui // ===================================================== // // - "==>": Events related to the rendering backend (OpenGL, Metal, Vulkan, DirectX, ...) - // - "-->": Events related to the windowing backend (SDL, Glfw, ...) + // - "-->": Events related to the platform backend (SDL, Glfw, ...) // int main() // { // // Init ImGui: ImGui::CreateContext(), etc. This is done inside // // --> AbstractRunner::Setup() // - // // Init Windowing Backend (SDL, Glfw, ...): call glfwInit() or SDL_Init() - // // See: AbstractRunner::Impl_InitBackend() + // // Init platform Backend (SDL, Glfw, ...): call glfwInit() or SDL_Init() + // // See: AbstractRunner::Impl_InitPlatformBackend() // // // Create Window, for Sdl or Glfw: // // --> AbstractRunner::Impl_CreateWindow()) @@ -34,7 +34,7 @@ namespace HelloImGui // // which may set some renderer specific hints // // ==> search for RenderingCallbacks_Impl_Hint_WindowingBackend in the code // - // // --> Call AbstractRunner::Impl_LinkWindowingToRenderingBackend + // // --> Call AbstractRunner::Impl_LinkPlatformAndRenderBackends // // ==> search for RenderingCallbacks_LinkWindowingToRenderingBackend in the code // // // This loop control is inside AbstractRunner::Run() @@ -42,13 +42,13 @@ namespace HelloImGui // while( ! appFinished) // { // - // // Poll windowing backend events + // // Poll platform backend events // // --> inside AbstractRunner::Impl_PollEvents() // // // Create a new frame in the rendering backend // // ==> call RenderingCallbacks.Impl_NewFrame_3D // - // // Create a new frame in ImGui and in the Windowing Backend + // // Create a new frame in ImGui and in the platform Backend // // (for example ImGui_ImplGlfw_NewFrame() + ImGui::NewFrame())) // // --> AbstractRunner::Impl_NewFrame_Backend() // @@ -74,7 +74,7 @@ namespace HelloImGui // // Shutdown ImGui // ImGui::DestroyContext(); // - // // Shutdown Windowing Backend + // // Shutdown platform Backend // // --> AbstractRunner::Impl_Cleanup() // // // Shutdown rendering backend @@ -82,7 +82,7 @@ namespace HelloImGui // } // - // There is no Init backend here, since it needs to account for the Windowing Backend and the Rendering Backend. + // There is no Init backend here, since it needs to account for the Platform Backend and the Rendering Backend. // As a consequence, it is implemented in the Rendering Backend, with #ifdefs // // "Callbacks" that are dependent on the combination Rendering backend (OpenGL, Metal, Vulkan) + Windowing Backend (Glfw, SDL): diff --git a/src/hello_imgui/internal/backend_impls/runner_glfw3.cpp b/src/hello_imgui/internal/backend_impls/runner_glfw3.cpp index 08cd369e..ff588f1d 100644 --- a/src/hello_imgui/internal/backend_impls/runner_glfw3.cpp +++ b/src/hello_imgui/internal/backend_impls/runner_glfw3.cpp @@ -49,7 +49,7 @@ namespace HelloImGui mBackendWindowHelper = std::make_unique(); } - void RunnerGlfw3::Impl_InitBackend() + void RunnerGlfw3::Impl_InitPlatformBackend() { glfwSetErrorCallback(glfw_error_callback); #ifdef __APPLE__ @@ -164,7 +164,7 @@ namespace HelloImGui // /////////////////////////////////////////////////////////////////////////////////////////////// #if defined(HELLOIMGUI_HAS_OPENGL) - void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend() + void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends() { ImGui_ImplGlfw_InitForOpenGL((GLFWwindow *)mWindow, true); ImGui_ImplOpenGL3_Init(Impl_GlslVersion().c_str()); @@ -193,7 +193,7 @@ namespace HelloImGui { mRenderingBackendCallbacks = CreateBackendCallbacks_GlfwMetal(); } - void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend() + void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends() { PrepareGlfwForMetal((GLFWwindow *) mWindow); } @@ -204,7 +204,7 @@ namespace HelloImGui // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend mRenderingBackendCallbacks = CreateBackendCallbacks_GlfwVulkan(); } - void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend() + void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends() { // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend PrepareGlfwForVulkan((GLFWwindow *) mWindow); @@ -216,7 +216,7 @@ namespace HelloImGui // // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend // mRenderingBackendCallbacks = CreateBackendCallbacks_GlfwDx11(); // } -// void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend() +// void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends() // { // // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend // PrepareGlfwForDx11((GLFWwindow *) mWindow); @@ -228,7 +228,7 @@ namespace HelloImGui // // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend // mRenderingBackendCallbacks = CreateBackendCallbacks_GlfwDx12(); // } -// void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend() +// void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends() // { // // Below, call of RenderingCallbacks_LinkWindowingToRenderingBackend // PrepareGlfwForDx12((GLFWwindow *) mWindow); diff --git a/src/hello_imgui/internal/backend_impls/runner_glfw3.h b/src/hello_imgui/internal/backend_impls/runner_glfw3.h index a473f899..b1d3ea6b 100644 --- a/src/hello_imgui/internal/backend_impls/runner_glfw3.h +++ b/src/hello_imgui/internal/backend_impls/runner_glfw3.h @@ -15,9 +15,9 @@ class RunnerGlfw3 : public AbstractRunner protected: // - // Methods related to the Windowing backend (SDL, Glfw, ...) + // Methods related to the platform backend (SDL, Glfw, ...) // - void Impl_InitBackend() override; + void Impl_InitPlatformBackend() override; void Impl_CreateWindow() override; void Impl_PollEvents() override; void Impl_NewFrame_Backend() override; @@ -27,9 +27,9 @@ class RunnerGlfw3 : public AbstractRunner void Impl_SetWindowIcon() override; // - // Linking the windowing backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) + // Linking the platform backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) // - void Impl_LinkWindowingToRenderingBackend() override; + void Impl_LinkPlatformAndRenderBackends() override; // Specific to OpenGL #ifdef HELLOIMGUI_HAS_OPENGL void Impl_Select_Gl_Version() override; diff --git a/src/hello_imgui/internal/backend_impls/runner_sdl2.cpp b/src/hello_imgui/internal/backend_impls/runner_sdl2.cpp index 166a4cfd..4a7f6be5 100644 --- a/src/hello_imgui/internal/backend_impls/runner_sdl2.cpp +++ b/src/hello_imgui/internal/backend_impls/runner_sdl2.cpp @@ -53,7 +53,7 @@ namespace HelloImGui } - void RunnerSdl2::Impl_InitBackend() + void RunnerSdl2::Impl_InitPlatformBackend() { auto flags = SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER; #ifdef __EMSCRIPTEN__ @@ -62,7 +62,7 @@ namespace HelloImGui if (SDL_Init(flags) != 0) { HIMG_ERROR( - std::string("RunnerSdlOpenGl3::Impl_InitBackend error ") + std::string("RunnerSdlOpenGl3::Impl_InitPlatformBackend error ") + SDL_GetError()); } @@ -248,7 +248,7 @@ namespace HelloImGui mRenderingBackendCallbacks = CreateBackendCallbacks_OpenGl3(); } - void RunnerSdl2::Impl_LinkWindowingToRenderingBackend() + void RunnerSdl2::Impl_LinkPlatformAndRenderBackends() { ImGui_ImplSDL2_InitForOpenGL((SDL_Window *)mWindow, mGlContext); ImGui_ImplOpenGL3_Init(Impl_GlslVersion().c_str()); @@ -273,7 +273,7 @@ namespace HelloImGui { mRenderingBackendCallbacks = CreateBackendCallbacks_SdlMetal(); } - void RunnerSdl2::Impl_LinkWindowingToRenderingBackend() + void RunnerSdl2::Impl_LinkPlatformAndRenderBackends() { PrepareSdlForMetal((SDL_Window*)mWindow); } @@ -283,7 +283,7 @@ namespace HelloImGui { mRenderingBackendCallbacks = CreateBackendCallbacks_SdlVulkan(); } - void RunnerSdl2::Impl_LinkWindowingToRenderingBackend() + void RunnerSdl2::Impl_LinkPlatformAndRenderBackends() { PrepareSdlForVulkan((SDL_Window*)mWindow); } @@ -293,7 +293,7 @@ namespace HelloImGui { mRenderingBackendCallbacks = CreateBackendCallbacks_SdlDx11(); } - void RunnerSdl2::Impl_LinkWindowingToRenderingBackend() + void RunnerSdl2::Impl_LinkPlatformAndRenderBackends() { PrepareSdlForDx11((SDL_Window*)mWindow); } @@ -303,7 +303,7 @@ namespace HelloImGui { mRenderingBackendCallbacks = CreateBackendCallbacks_SdlDx12(); } - void RunnerSdl2::Impl_LinkWindowingToRenderingBackend() + void RunnerSdl2::Impl_LinkPlatformAndRenderBackends() { PrepareSdlForDx12((SDL_Window*)mWindow); } diff --git a/src/hello_imgui/internal/backend_impls/runner_sdl2.h b/src/hello_imgui/internal/backend_impls/runner_sdl2.h index d04db852..de987219 100644 --- a/src/hello_imgui/internal/backend_impls/runner_sdl2.h +++ b/src/hello_imgui/internal/backend_impls/runner_sdl2.h @@ -8,16 +8,16 @@ namespace HelloImGui { class RunnerSdl2 : public AbstractRunner -{ + { public: RunnerSdl2(RunnerParams & runnerParams); virtual ~RunnerSdl2() = default; protected: // - // Methods related to the Windowing backend (SDL, Glfw, ...) + // Methods related to the platform backend (SDL, Glfw, ...) // - void Impl_InitBackend() override; + void Impl_InitPlatformBackend() override; void Impl_CreateWindow() override; void Impl_PollEvents() override; void Impl_NewFrame_Backend() override; @@ -27,9 +27,9 @@ namespace HelloImGui void Impl_SetWindowIcon() override; // - // Linking the windowing backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) + // Linking the platform backend (SDL, Glfw, ...) to the rendering backend (OpenGL, ...) // - void Impl_LinkWindowingToRenderingBackend() override; + void Impl_LinkPlatformAndRenderBackends() override; // Specific to OpenGL #ifdef HELLOIMGUI_HAS_OPENGL void Impl_Select_Gl_Version() override; diff --git a/src/hello_imgui/runner_params.h b/src/hello_imgui/runner_params.h index 40a8f745..de88485f 100644 --- a/src/hello_imgui/runner_params.h +++ b/src/hello_imgui/runner_params.h @@ -10,7 +10,7 @@ namespace HelloImGui { -// Windowing backend type (SDL, GLFW) +// Platform backend type (SDL, GLFW) enum class BackendType { FirstAvailable, @@ -107,7 +107,7 @@ struct FpsIdling A struct that contains optional pointers to the backend implementations. These pointers will be filled when the application starts * `backendType`: _enum BackendType, default=BackendType::FirstAvailable_ - Select the wanted Windowing backend type between `Sdl`, `Glfw`. Only useful when multiple backend are compiled + Select the wanted platform backend type between `Sdl`, `Glfw`. 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_.