| 1 | // dear imgui: Renderer + Platform Backend for Allegro 5 |
| 2 | // (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.) |
| 3 | |
| 4 | // Implemented features: |
| 5 | // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as texture identifier. Read the FAQ about ImTextureID/ImTextureRef! |
| 6 | // [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures). |
| 7 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy ALLEGRO_KEY_* values are obsolete since 1.87 and not supported since 1.91.5] |
| 8 | // [X] Platform: Clipboard support (from Allegro 5.1.12). |
| 9 | // [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. |
| 10 | // Missing features or Issues: |
| 11 | // [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. |
| 12 | // [ ] Renderer: Missing support for DrawCallback_SetSamplerLinear, DrawCallback_SetSamplerNearest callbacks: Allegro5 cannot enable/disable LINEAR bitmap flags after creation. |
| 13 | // [ ] Platform: Missing gamepad support. |
| 14 | // [ ] Renderer: Multi-viewport support (multiple windows). |
| 15 | |
| 16 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. |
| 17 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. |
| 18 | // Learn about Dear ImGui: |
| 19 | // - FAQ https://dearimgui.com/faq |
| 20 | // - Getting Started https://dearimgui.com/getting-started |
| 21 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). |
| 22 | // - Introduction, links and more at the top of imgui.cpp |
| 23 | |
| 24 | #pragma once |
| 25 | #include "imgui.h" // IMGUI_IMPL_API |
| 26 | #ifndef IMGUI_DISABLE |
| 27 | |
| 28 | struct ALLEGRO_DISPLAY; |
| 29 | union ALLEGRO_EVENT; |
| 30 | |
| 31 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! |
| 32 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display); |
| 33 | IMGUI_IMPL_API void ImGui_ImplAllegro5_Shutdown(); |
| 34 | IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame(); |
| 35 | IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); |
| 36 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); |
| 37 | IMGUI_IMPL_API void ImGui_ImplAllegro5_SetDisplay(ALLEGRO_DISPLAY* display); |
| 38 | |
| 39 | // Use if you want to reset your rendering device without losing Dear ImGui state. |
| 40 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); |
| 41 | IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); |
| 42 | |
| 43 | // (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = nullptr to handle this manually. |
| 44 | IMGUI_IMPL_API void ImGui_ImplAllegro5_UpdateTexture(ImTextureData* tex); |
| 45 | |
| 46 | #endif // #ifndef IMGUI_DISABLE |