imgui-mirror/backends/imgui_impl_android.h
Sharadh Rajaraman 08fbbd9624 backends: prepare for inclusion in a C++20 module purview
Each backend becomes its own module that imports 'imgui' and includes
its header and source in the purview. Do the same preparation as for
the core:
- Skip system, platform and graphics API includes under
  IMGUI_CXX_MODULE, because the module includes them in its global
  module fragment.
- Skip the forward declarations of platform types (GLFWwindow,
  SDL_Window, ID3D11Device...). Declared in the purview, they would be
  new types attached to the backend module instead of the real ones.
  For the same reason, sdl2 drops the elaborated
  'struct _SDL_GameController'.
- Wrap each header's API in IMGUI_EXPORT_BEGIN/END.
- win32: export ImGui_ImplWin32_WndProcHandler() under IMGUI_CXX_MODULE.
  The header keeps it commented out to avoid pulling in <windows.h>,
  but a module user can't forward-declare it themselves.
- glfw: skip the local GetIO(ImGuiContext*) declaration, because
  'imgui' exports it.
2026-09-28 16:11:53 +00:00

42 lines
2.2 KiB
C

// dear imgui: Platform Binding for Android native app
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
// Implemented features:
// [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 AKEYCODE_* values are obsolete since 1.87 and not supported since 1.91.5]
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen.
// Missing features or Issues:
// [ ] Platform: Clipboard support.
// [ ] Platform: Gamepad support.
// [ ] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
// Important:
// - Consider using SDL or GLFW backend on Android, which will be more full-featured than this.
// - FIXME: On-screen keyboard currently needs to be enabled by the application (see examples/ and issue #3446)
// - FIXME: Unicode character inputs needs to be passed by Dear ImGui by the application (see examples/ and issue #3446)
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
// - Getting Started https://dearimgui.com/getting-started
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
// - Introduction, links and more at the top of imgui.cpp
#pragma once
#include "imgui.h" // IMGUI_IMPL_API
#ifndef IMGUI_DISABLE
#ifndef IMGUI_CXX_MODULE
struct ANativeWindow;
struct AInputEvent;
#endif
IMGUI_EXPORT_BEGIN
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
IMGUI_IMPL_API bool ImGui_ImplAndroid_Init(ANativeWindow* window);
IMGUI_IMPL_API int32_t ImGui_ImplAndroid_HandleInputEvent(const AInputEvent* input_event);
IMGUI_IMPL_API void ImGui_ImplAndroid_Shutdown();
IMGUI_IMPL_API void ImGui_ImplAndroid_NewFrame();
IMGUI_EXPORT_END
#endif // #ifndef IMGUI_DISABLE