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