Something went wrong. Try again.
A puzzle game of bent arrows sent off a board of dots, written in Zig.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! The parts of the NDK the game uses, declared here rather than translated//! from its headers: the native activity and its callbacks, the looper, the//! input queue and its events, the window, the choreographer, and the log.//! Everything is in `libandroid` and `liblog`, which every device has; see//! ADR 0001 and ADR 0003.
const jni = @import("jni.zig");
pub const ANativeWindow = opaque {};pub const AInputQueue = opaque {};pub const AInputEvent = opaque {};pub const ALooper = opaque {};pub const AChoreographer = opaque {};pub const AAssetManager = opaque {};
pub const ARect = extern struct { left: i32, top: i32, right: i32, bottom: i32,};
/// `<android/native_activity.h>`.pub const ANativeActivity = extern struct { callbacks: *Callbacks, vm: *jni.JavaVM, /// For the main thread only. env: *jni.Env, /// The `android.app.NativeActivity` itself. clazz: jni.Object, internal_data_path: [*:0]const u8, external_data_path: ?[*:0]const u8, sdk_version: i32, /// Ours. instance: ?*anyopaque, asset_manager: ?*AAssetManager, obb_path: ?[*:0]const u8,
/// Called on the main thread, the one the activity's own methods run /// on; each is the activity's method of the same name. pub const Callbacks = extern struct { onStart: ?*const fn (*ANativeActivity) callconv(.c) void = null, onResume: ?*const fn (*ANativeActivity) callconv(.c) void = null, onSaveInstanceState: ?*const fn (*ANativeActivity, *usize) callconv(.c) ?*anyopaque = null, onPause: ?*const fn (*ANativeActivity) callconv(.c) void = null, onStop: ?*const fn (*ANativeActivity) callconv(.c) void = null, onDestroy: ?*const fn (*ANativeActivity) callconv(.c) void = null, onWindowFocusChanged: ?*const fn (*ANativeActivity, c_int) callconv(.c) void = null, onNativeWindowCreated: ?*const fn (*ANativeActivity, *ANativeWindow) callconv(.c) void = null, onNativeWindowResized: ?*const fn (*ANativeActivity, *ANativeWindow) callconv(.c) void = null, onNativeWindowRedrawNeeded: ?*const fn (*ANativeActivity, *ANativeWindow) callconv(.c) void = null, onNativeWindowDestroyed: ?*const fn (*ANativeActivity, *ANativeWindow) callconv(.c) void = null, onInputQueueCreated: ?*const fn (*ANativeActivity, *AInputQueue) callconv(.c) void = null, onInputQueueDestroyed: ?*const fn (*ANativeActivity, *AInputQueue) callconv(.c) void = null, onContentRectChanged: ?*const fn (*ANativeActivity, *const ARect) callconv(.c) void = null, onConfigurationChanged: ?*const fn (*ANativeActivity) callconv(.c) void = null, onLowMemory: ?*const fn (*ANativeActivity) callconv(.c) void = null, };};
pub extern "android" fn ANativeActivity_finish(activity: *ANativeActivity) void;
pub extern "android" fn ANativeWindow_getWidth(window: *ANativeWindow) i32;pub extern "android" fn ANativeWindow_getHeight(window: *ANativeWindow) i32;pub extern "android" fn ANativeWindow_acquire(window: *ANativeWindow) void;pub extern "android" fn ANativeWindow_release(window: *ANativeWindow) void;
pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1;pub const ALOOPER_POLL_WAKE = -1;pub const ALOOPER_POLL_CALLBACK = -2;pub const ALOOPER_POLL_TIMEOUT = -3;pub const ALOOPER_POLL_ERROR = -4;
pub const ALooper_callbackFunc = *const fn (fd: c_int, events: c_int, data: ?*anyopaque) callconv(.c) c_int;
pub extern "android" fn ALooper_prepare(opts: c_int) *ALooper;pub extern "android" fn ALooper_pollOnce(timeout_millis: c_int, out_fd: ?*c_int, out_events: ?*c_int, out_data: ?*?*anyopaque) c_int;pub extern "android" fn ALooper_wake(looper: *ALooper) void;
pub extern "android" fn AInputQueue_attachLooper(queue: *AInputQueue, looper: *ALooper, ident: c_int, callback: ?ALooper_callbackFunc, data: ?*anyopaque) void;pub extern "android" fn AInputQueue_detachLooper(queue: *AInputQueue) void;pub extern "android" fn AInputQueue_getEvent(queue: *AInputQueue, out_event: *?*AInputEvent) i32;pub extern "android" fn AInputQueue_preDispatchEvent(queue: *AInputQueue, event: *AInputEvent) i32;pub extern "android" fn AInputQueue_finishEvent(queue: *AInputQueue, event: *AInputEvent, handled: c_int) void;
pub const AINPUT_EVENT_TYPE_KEY = 1;pub const AINPUT_EVENT_TYPE_MOTION = 2;
pub extern "android" fn AInputEvent_getType(event: *const AInputEvent) i32;
pub const AKEY_EVENT_ACTION_DOWN = 0;pub const AKEY_EVENT_ACTION_UP = 1;
pub const AKEYCODE_Q = 45;pub const AKEYCODE_R = 46;pub const AKEYCODE_ESCAPE = 111;
pub extern "android" fn AKeyEvent_getAction(event: *const AInputEvent) i32;pub extern "android" fn AKeyEvent_getKeyCode(event: *const AInputEvent) i32;pub extern "android" fn AKeyEvent_getRepeatCount(event: *const AInputEvent) i32;
pub const AMOTION_EVENT_ACTION_MASK = 0xff;pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00;pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;pub const AMOTION_EVENT_ACTION_UP = 1;pub const AMOTION_EVENT_ACTION_POINTER_UP = 6;
pub extern "android" fn AMotionEvent_getAction(event: *const AInputEvent) i32;pub extern "android" fn AMotionEvent_getX(event: *const AInputEvent, pointer_index: usize) f32;pub extern "android" fn AMotionEvent_getY(event: *const AInputEvent, pointer_index: usize) f32;
pub const AChoreographer_frameCallback64 = *const fn (frame_time_nanos: i64, data: ?*anyopaque) callconv(.c) void;
/// For the calling thread, which must have a looper.pub extern "android" fn AChoreographer_getInstance() ?*AChoreographer;/// API 29.pub extern "android" fn AChoreographer_postFrameCallback64(choreographer: *AChoreographer, callback: AChoreographer_frameCallback64, data: ?*anyopaque) void;
pub const ANDROID_LOG_DEBUG = 3;pub const ANDROID_LOG_INFO = 4;pub const ANDROID_LOG_WARN = 5;pub const ANDROID_LOG_ERROR = 6;pub const ANDROID_LOG_FATAL = 7;
pub extern "log" fn __android_log_write(priority: c_int, tag: [*:0]const u8, text: [*:0]const u8) c_int;