1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Low-level Android backend shim.
//!
//! This module wraps the repository-owned C shim around Dear ImGui's official
//! `imgui_impl_android` backend.
//!
//! # Safety
//!
//! Callers must provide valid `ANativeWindow*` and `AInputEvent*` pointers, keep
//! the intended Dear ImGui context current, and pair init/new-frame/input/shutdown
//! calls in the order required by the official backend. Android activity, EGL /
//! GLES context creation, and APK packaging remain owned by the application.
//! The official Android backend stores its window and timing in process-global state: only one
//! Android backend may be active, even across different ImGui contexts. It borrows the native
//! window without acquiring a reference; keep that window alive until shutdown returns, and shut
//! down during the window-termination callback before acknowledging it. Do not initialize a second window
//! or context while the first backend is active.
//!
//! Typical usage:
//!
//! - initialize with an `ANativeWindow*`
//! - call `dear_imgui_backend_android_new_frame()` once per frame
//! - optionally forward raw `AInputEvent*` values through
//! `dear_imgui_backend_android_handle_input_event()`
//! - shut down before destroying the associated window / activity state
//!
//! If your Android stack uses a higher-level input wrapper such as
//! `android-activity`, you may instead translate input into `dear-imgui-rs::Io`
//! manually and only reuse the window + frame lifecycle parts here.
use c_void;
unsafe extern "C"