Skip to content

Commit

Permalink
Wording: windowing backend -> platform backend
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jan 1, 2024
1 parent 7dcf023 commit 76182c7
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hello_imgui_cmake/hello_imgui_build_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/hello_imgui/hello_imgui_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_.
Expand Down
10 changes: 5 additions & 5 deletions src/hello_imgui/internal/backend_impls/abstract_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/hello_imgui/internal/backend_impls/abstract_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void RunnerQt::RunQGuiApplication()
}


void RunnerQt::Impl_InitBackend()
void RunnerQt::Impl_InitPlatformBackend()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/hello_imgui/internal/backend_impls/rendering_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -34,21 +34,21 @@ 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()
// // its body is inside --> AbstractRunner::CreateFramesAndRender()
// 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()
//
Expand All @@ -74,15 +74,15 @@ namespace HelloImGui
// // Shutdown ImGui
// ImGui::DestroyContext();
//
// // Shutdown Windowing Backend
// // Shutdown platform Backend
// // --> AbstractRunner::Impl_Cleanup()
//
// // Shutdown rendering backend
// // ==> call RenderingCallbacks.Impl_Shutdown_3D()
// }

//
// 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):
Expand Down
12 changes: 6 additions & 6 deletions src/hello_imgui/internal/backend_impls/runner_glfw3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace HelloImGui
mBackendWindowHelper = std::make_unique<BackendApi::GlfwWindowHelper>();
}

void RunnerGlfw3::Impl_InitBackend()
void RunnerGlfw3::Impl_InitPlatformBackend()
{
glfwSetErrorCallback(glfw_error_callback);
#ifdef __APPLE__
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -193,7 +193,7 @@ namespace HelloImGui
{
mRenderingBackendCallbacks = CreateBackendCallbacks_GlfwMetal();
}
void RunnerGlfw3::Impl_LinkWindowingToRenderingBackend()
void RunnerGlfw3::Impl_LinkPlatformAndRenderBackends()
{
PrepareGlfwForMetal((GLFWwindow *) mWindow);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/hello_imgui/internal/backend_impls/runner_glfw3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/hello_imgui/internal/backend_impls/runner_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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());
}

Expand Down Expand Up @@ -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());
Expand All @@ -273,7 +273,7 @@ namespace HelloImGui
{
mRenderingBackendCallbacks = CreateBackendCallbacks_SdlMetal();
}
void RunnerSdl2::Impl_LinkWindowingToRenderingBackend()
void RunnerSdl2::Impl_LinkPlatformAndRenderBackends()
{
PrepareSdlForMetal((SDL_Window*)mWindow);
}
Expand All @@ -283,7 +283,7 @@ namespace HelloImGui
{
mRenderingBackendCallbacks = CreateBackendCallbacks_SdlVulkan();
}
void RunnerSdl2::Impl_LinkWindowingToRenderingBackend()
void RunnerSdl2::Impl_LinkPlatformAndRenderBackends()
{
PrepareSdlForVulkan((SDL_Window*)mWindow);
}
Expand All @@ -293,7 +293,7 @@ namespace HelloImGui
{
mRenderingBackendCallbacks = CreateBackendCallbacks_SdlDx11();
}
void RunnerSdl2::Impl_LinkWindowingToRenderingBackend()
void RunnerSdl2::Impl_LinkPlatformAndRenderBackends()
{
PrepareSdlForDx11((SDL_Window*)mWindow);
}
Expand All @@ -303,7 +303,7 @@ namespace HelloImGui
{
mRenderingBackendCallbacks = CreateBackendCallbacks_SdlDx12();
}
void RunnerSdl2::Impl_LinkWindowingToRenderingBackend()
void RunnerSdl2::Impl_LinkPlatformAndRenderBackends()
{
PrepareSdlForDx12((SDL_Window*)mWindow);
}
Expand Down
10 changes: 5 additions & 5 deletions src/hello_imgui/internal/backend_impls/runner_sdl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/hello_imgui/runner_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace HelloImGui
{

// Windowing backend type (SDL, GLFW)
// Platform backend type (SDL, GLFW)
enum class BackendType
{
FirstAvailable,
Expand Down Expand Up @@ -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_.
Expand Down

0 comments on commit 76182c7

Please sign in to comment.