Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big example/backend/binding refactor #1870

Closed
ocornut opened this issue Jun 8, 2018 · 2 comments
Closed

Big example/backend/binding refactor #1870

ocornut opened this issue Jun 8, 2018 · 2 comments
Labels
Milestone

Comments

@ocornut
Copy link
Owner

ocornut commented Jun 8, 2018

I have started working on merging some of the examples/binding reorganization work started in the viewport branch. I'm creating this topic here to centralize information and references (and so I can have an issue # to refer to). Will probably create a new temporary branch before moving to master.

Stay tuned!

@ocornut ocornut added this to the v1.62 milestone Jun 8, 2018
ocornut added a commit that referenced this issue Jun 10, 2018
… stripped out of Viewport code). (#1870)

Read examples/README.txt for some details.
ImDrawData: Added DisplayPos, DisplaySize fields honored by all backends (not strictly necessary to honor just now, but doing it to be ahead)
ocornut added a commit that referenced this issue Jun 10, 2018
# Conflicts:
#	examples/README.txt
#	examples/directx11_example/main.cpp
#	examples/directx12_example/main.cpp
#	examples/imgui_impl_dx10.cpp
#	examples/imgui_impl_dx11.cpp
#	examples/imgui_impl_dx12.cpp
#	examples/imgui_impl_glfw.cpp
#	examples/imgui_impl_opengl2.cpp
#	examples/imgui_impl_opengl2.h
#	examples/imgui_impl_opengl3.cpp
#	examples/imgui_impl_sdl2.cpp
#	examples/imgui_impl_sdl2.h
#	examples/imgui_impl_vulkan.cpp
#	examples/imgui_impl_vulkan.h
#	examples/imgui_impl_win32.cpp
#	examples/imgui_impl_win32.h
#	examples/opengl2_example/main.cpp
#	examples/opengl3_example/main.cpp
#	examples/sdl_opengl2_example/main.cpp
#	examples/sdl_opengl3_example/main.cpp
#	examples/sdl_vulkan_example/main.cpp
#	examples/vulkan_example/main.cpp
#	imgui.cpp
#	imgui.h
@ocornut
Copy link
Owner Author

ocornut commented Jun 22, 2018

This was merged and part of 1.62. Keeping this open for a short while for additional feedback but will close soon. Feel free to comment if you are landing here from one of the many links. Basically the examples/ code in master now mimics the reorganization done for the viewport branch (viewport branch has a handful of other changes, but the overall architecture matches and make merging branches easy).

The release note says:


In the examples/ folder:

before: imgui_impl_dx11.cpp        --> after: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
before: imgui_impl_dx12.cpp        --> after: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
before: imgui_impl_glfw_gl3.cpp    --> after: imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
before: imgui_impl_glfw_vulkan.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
before: imgui_impl_sdl_gl3.cpp     --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
before: imgui_impl_sdl_gl3.cpp     --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp 
etc.
  • Examples back-ends have been refactored to separate the platform code (e.g. Win32, Glfw, SDL2) from the renderer code (e.g. DirectX11, OpenGL3, Vulkan).
    • The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc.
    • The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data.
    • The idea is what we can now easily combine and maintain back-ends and reduce code redundancy. Individual files are smaller and more reusable. Integration of imgui into a new/custom engine may also be easier as there is less overlap between "windowing / inputs" and "rendering" code, so you may study or grab one half of the code and not the other.
    • This change was motivated by the fact that adding support for the upcoming multi-viewport feature requires more work from the Platform and Renderer back-ends, and the amount of redundancy across files was becoming too difficult to maintain. If you use default back-ends, you'll benefit from an easy update path to support multi-viewports later (for future ImGui 1.7x).
    • This is not strictly a breaking change if you keep your old bindings, but when you'll want to fully update your bindings, expect to have to reshuffle a few things.
    • Each example still has its own main.cpp which you may refer you to understand how to initialize and glue everything together.
    • Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
    • Read examples/README.txt for more details.

Other recent changes applied to Examples/

  • Examples: GLFW: Made it possible to Shutdown/Init the back-end again (by reseting the time storage properly). (Make subsequent window creation possible #1827) [@ice1000]
  • Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (Win32 Mousewheel: Scale input by WHEEL_DELTA #1874) [@zx64]
  • Examples: SDL+Vulkan: Added SDL+Vulkan example.
  • Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag. Added clipboard support.
  • Examples: Allegro5: Unindexing buffers ourselves as Allegro indexed drawing primitives are buggy in the DirectX9 back-end (will be fixed in Allegro 5.2.5+).
  • Examples: DirectX12: Moved the ID3D12GraphicsCommandList* parameter from ImGui_ImplDX12_NewFrame() to ImGui_ImplDX12_RenderDrawData() which makes a lots more sense. (D3D12 implementation #301)
  • Examples: FreeGLUT: Added FreeGLUT bindings. Added FreeGLUT+OpenGL2 example. (Freeglut OpenGL2 example #801)
  • Examples: Vulkan: Reordered parameters ImGui_ImplVulkan_RenderDrawData() to be consistent with other bindings, a good occasion since we refactored the code.
  • Examples: The functions in imgui_impl_xxx.cpp are prefixed with IMGUI_IMPL_API (which defaults to IMGUI_API) to facilitate some uses. (IMGUI_API in imgui.h and imgui_impl_... #1888)
  • Examples: Fixed bindings to use ImGuiMouseCursor_COUNT instead of old name ImGuiMouseCursor_Count_ so they can compile with IMGUI_DISABLE_OBSOLETE_FUNCTIONS. (ImGuiMouseCursor_COUNT #1887)

@ocornut
Copy link
Owner Author

ocornut commented Jun 27, 2018

Closing this.

@ocornut ocornut closed this as completed Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant