347 Commits

Author SHA1 Message Date
Robert Bragg 1ca5f13874 android_native_app_glue: expose helpers for attaching input queue to looper 2022-07-06 15:26:14 +01:00
Robert Bragg eda89d0e15 generate-bindings: use ANDROID_NDK_HOME if set 2022-07-06 14:58:29 +01:00
Robert Bragg a8e8017918 Bump ndk/ndk-sys deps for consistency with winit master v0.1.1 2022-07-04 20:54:20 +01:00
Robert Bragg a8c0e37d80 Fix for generate-bindings.sh and updates generated ffi bindings 2022-07-04 20:40:03 +01:00
Robert Bragg 3f06bce6ce Cargo.toml: Add docs.rs link 2022-07-04 19:39:03 +01:00
Robert Bragg 74b2f22494 docs: generate docs as if native-activity feature enabled 2022-07-04 02:39:59 +01:00
Robert Bragg ffaabf09c8 Cargo.toml tweaks for publishing v0.1.0 2022-07-04 00:21:29 +01:00
Robert Bragg b63b5e15fa Update READMEs 2022-07-03 23:34:25 +01:00
Robert Bragg 2264826535 Update examples to use android_activity 2022-07-03 22:18:46 +01:00
Robert Bragg 12aa17ee42 Remove redundant game-activity + native-activity crates 2022-07-03 22:18:46 +01:00
Robert Bragg 86a4ba1662 Adds configurable android-activity crate
This general Activity glue crate now supersedes the two separate
native-activity and game-activity crates.

The adds the functionality of both crates as modules within this
new crate but provides a single crate + API that downstream can
depend on as an Activity glue layer.

The new crate exposes two (mutually-exclusive) features for
choosing which Activity backend to build:
* "native-activity"
* "game-activity"

This common crate makes it more practical to write code that's
Activity agnostic.
2022-07-03 22:18:46 +01:00
Robert Bragg d4459921b9 Remove global android_app() API
android_main() now takes an `app: AndroidApp` argument and has an
extern "Rust" ABI instead of "C" ABI.

This should help make it possible to run multiple native Activities in a
single process.
2022-07-03 22:18:45 +01:00
Robert Bragg 0565ae01ec Expose native_window() via AndroidApp instead of static
To be able to support multiple activities per-process we can't have any
static/global state.
2022-07-03 22:18:45 +01:00
Robert Bragg 70e33c9635 na-subclass-jni example: add ndk-context dep 2022-07-03 22:18:45 +01:00
Robert Bragg 864d782c24 Attach native thread to JVM before calling android_main 2022-05-28 02:54:00 +01:00
Robert Bragg c492fead0f App: Expose internal/ext/obb paths + sdk_version
This exposes the state from ANativeActivity and GameActivity in a
portable (Activity agnostic) way.
2022-05-28 02:53:59 +01:00
Robert Bragg 2a8fc83ea2 build.rs: disable 'extra' warnings 2022-05-28 02:53:59 +01:00
Robert Bragg 73d56ede5f GameActivity PATCH: remove unused variable 2022-05-28 02:53:59 +01:00
Robert Bragg a0f52a2398 GameActivity PATCH: sync with upstream 2022-05-28 02:53:59 +01:00
Robert Bragg d929a88468 README: add adb logcat command to initial example 2022-05-25 22:30:23 +01:00
Robert Bragg 5d38fdf593 A few minor simplifications of the *-mainloop examples 2022-05-25 22:27:53 +01:00
Robert Bragg 4f8227b5ba Add an initial top-level README 2022-05-25 20:19:34 +01:00
Robert Bragg 99fc467be0 Add minimal NativeActivity subclass example with JNI 2022-05-23 01:58:57 +01:00
Robert Bragg 084b807319 agdk-egui: build with upstream master branch 2022-05-23 01:51:50 +01:00
Robert Bragg 2f3dbf12a6 add android:configChanges to manifests + remove some unused xml 2022-05-23 01:43:03 +01:00
Robert Bragg b2a675cb40 native-activity: remove unused input.rs copied from game-activity 2022-05-20 05:13:50 +01:00
Robert Bragg 9ac0e2f6e2 na-winit-wgpu: don't look for winit crate locally by default 2022-05-20 05:03:47 +01:00
Robert Bragg bab9bcf104 Add na-winit-wgpu example based on NativeActivity 2022-05-20 04:07:29 +01:00
Robert Bragg 19784d95e3 Add minimal mainloop example based on NativeActivity 2022-05-20 04:07:23 +01:00
Robert Bragg 0c3c4db1a6 Add initial native-activity glue crate 2022-05-20 04:07:17 +01:00
Robert Bragg 8ca76116be Cargo.toml: exclude examples/agdk-egui from workspace 2022-05-20 02:46:38 +01:00
Robert Bragg 316021e4ac agdk-winit-wgpu: use env_logger if not on Android 2022-05-20 02:46:38 +01:00
Robert Bragg 164957ec65 game-activity: rework input API
This leaves the InputBuffer abstraction as an implementation detail
and just exposes an API like this for processing input:

  app.input_events(|event| {
      // handle event
  });

The main consideration here was to have an API that could also be
supported via NativeActivity to keep open the possibility of a standard
Android 'glue' API.
2022-05-20 02:46:01 +01:00
Robert Bragg 57dda66a54 game-activity/README: refer to issue that describes ndk-glue sync concerns 2022-05-20 01:59:24 +01:00
Robert Bragg 3349344339 game-activity: support generating bindings on Windows 2022-05-20 01:59:24 +01:00
Robert Bragg 3f1e6ced43 GameActivity PATH: fix for checking history pointer samples 2022-05-20 01:59:24 +01:00
Robert Bragg 69d0de4db1 agdk-egui: use upstream egui-winit + egui-wgpu crates
The functionality found in egui_winit_platform and egui_wgpu_backend is
now available in the upstream egui-winit and egui-wgpu crates
respectively.

This has simplified the example itself and also removed the dependency
on epi.

The example is now based on egui 0.18 (was previously 0.17)

Since the upstream egui-winit/wgpu crates were generally assuming that
the graphics context and surface can be initialized immediately this
currently builds against a branch that aims to upstream changes that
remove these assumptions:

https://github.com/rib/egui/tree/android-deferred-winit-wgpu
Ref: https://github.com/emilk/egui/pull/1634
2022-05-17 18:20:25 +01:00
Robert Bragg bfc0d091e6 Add a minimal Egui + Winit + WGPU based example 2022-05-13 20:13:30 +01:00
Robert Bragg c36efc7f6b GameActivity PATCH: support capturing historic pointer samples 2022-05-12 02:58:49 +01:00
Robert Bragg 74e8ff645a Remove unused src/shader.wgsl from agdk-mainloop example 2022-05-10 03:08:56 +01:00
Robert Bragg 915f7382e5 Add a minimal Winit and WGPU based example 2022-05-10 02:04:25 +01:00
Robert Bragg 02dda282d0 Add basic agdk-mainloop example 2022-05-10 02:00:47 +01:00
Robert Bragg 32843ac726 GameActivity PATCH: rename symbols to export via Rust 2022-05-08 22:40:35 +01:00
Robert Bragg 9267b60938 GameActivity PATCH: compilation fixes
Fixes some compilation bugs in the upstream AGDK glue code:
https://issuetracker.google.com/issues/229997306
2022-05-08 22:40:34 +01:00
Robert Bragg e27b6b5a44 GameActivity PATCH: capture KeyEvent scanCode 2022-05-08 22:40:33 +01:00
Robert Bragg b97adb91f9 GameActivity PATCH: enable tracing 2022-05-08 22:40:32 +01:00
Robert Bragg 6fb438de82 Initial GameActivity glue implementation
This is based on the 2022.0.0 agdk-libraries release
2022-05-08 22:40:25 +01:00