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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! The root of the Android build: the shared library `NativeActivity`//! loads, which logs to logcat rather than to a standard error nobody//! reads.
const std = @import("std");
const ndk = @import("android/ndk.zig");const main = @import("android/main.zig");
/// The window type vulkan-zig's `VK_KHR_android_surface` takes, so that the/// NDK's window needs no cast to make a surface of.pub const ANativeWindow = ndk.ANativeWindow;
pub const std_options: std.Options = .{ .logFn = logcat };
pub const panic = std.debug.FullPanic(panicked);
const tag = "pfeilstorch";
export fn ANativeActivity_onCreate(activity: *ndk.ANativeActivity, saved: ?*anyopaque, saved_size: usize) void { _ = saved; _ = saved_size; main.onCreate(activity);}
fn logcat( comptime level: std.log.Level, comptime scope: @EnumLiteral(), comptime format: []const u8, args: anytype,) void { const priority: c_int = switch (level) { .err => ndk.ANDROID_LOG_ERROR, .warn => ndk.ANDROID_LOG_WARN, .info => ndk.ANDROID_LOG_INFO, .debug => ndk.ANDROID_LOG_DEBUG, }; const prefix = if (scope == .default) "" else @tagName(scope) ++ ": "; var buf: [1024]u8 = undefined; const text = std.fmt.bufPrintSentinel(&buf, prefix ++ format, args, 0) catch text: { // Cut short rather than lost. buf[buf.len - 1] = 0; break :text buf[0 .. buf.len - 1 :0]; }; _ = ndk.__android_log_write(priority, tag, text.ptr);}
fn panicked(message: []const u8, _: ?usize) noreturn { var buf: [1024]u8 = undefined; const text = std.fmt.bufPrintSentinel(&buf, "panic: {s}", .{message}, 0) catch "panic"; _ = ndk.__android_log_write(ndk.ANDROID_LOG_FATAL, tag, text.ptr); std.process.abort();}