imgui_impl_sdlrenderer2.h 2.6 KB

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