imgui_impl_sdlrenderer3.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // dear imgui: Renderer Backend for SDL_Renderer for SDL3
  2. // (Requires: SDL 3.0.0+)
  3. // (**IMPORTANT: SDL 3.0.0 is NOT YET RELEASED AND CURRENTLY HAS A FAST CHANGING API. THIS CODE BREAKS OFTEN AS SDL3 CHANGES.**)
  4. // Note how SDL_Renderer is an _optional_ component of SDL3.
  5. // For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
  6. // If your application will want to render any non trivial amount of graphics other than UI,
  7. // please be aware that SDL_Renderer currently offers a limited graphic API to the end-user and
  8. // it might be difficult to step out of those boundaries.
  9. // Implemented features:
  10. // [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
  11. // [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
  12. // [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
  13. // Missing features:
  14. // [ ] Renderer: Multi-viewport support (multiple windows).
  15. // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  16. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  17. // Learn about Dear ImGui:
  18. // - FAQ https://dearimgui.com/faq
  19. // - Getting Started https://dearimgui.com/getting-started
  20. // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
  21. // - Introduction, links and more at the top of imgui.cpp
  22. #pragma once
  23. #include "imgui.h" // IMGUI_IMPL_API
  24. #ifndef IMGUI_DISABLE
  25. struct SDL_Renderer;
  26. // Follow "Getting Started" link and check examples/ folder to learn about using backends!
  27. IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer);
  28. IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_Shutdown();
  29. IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_NewFrame();
  30. IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer);
  31. // Called by Init/NewFrame/Shutdown
  32. IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_CreateFontsTexture();
  33. IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_DestroyFontsTexture();
  34. IMGUI_IMPL_API bool ImGui_ImplSDLRenderer3_CreateDeviceObjects();
  35. IMGUI_IMPL_API void ImGui_ImplSDLRenderer3_DestroyDeviceObjects();
  36. // [BETA] Selected render state data shared with callbacks.
  37. // This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplSDLRenderer3_RenderDrawData() call.
  38. // (Please open an issue if you feel you need access to more data)
  39. struct ImGui_ImplSDLRenderer3_RenderState
  40. {
  41. SDL_Renderer* Renderer;
  42. };
  43. #endif // #ifndef IMGUI_DISABLE