mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 14:28:43 -06:00
nya
This commit is contained in:
parent
2849c11621
commit
518b2c3e79
|
@ -51,6 +51,7 @@ winapi = { version = "0.3", features = ["wincon"] }
|
|||
default = ["raw-evt-mouse"]
|
||||
raw-evt-keyboard = [] # use raw input for keyboard. works on x11 and windows, breaks keyboard on android and wayland
|
||||
raw-evt-mouse = [] # required for mouse input
|
||||
c-ffi = [] # generate a C-ffi-compatible `kubi_main` entry point (useful if building as a shared library)
|
||||
generate_visualizer_data = ["dep:serde_json", "shipyard/serde1"]
|
||||
safe_lz4 = ["lz4_flex/safe-encode", "lz4_flex/safe-decode"]
|
||||
parallel = ["shipyard/parallel"] # causes some serious issues!
|
||||
|
|
|
@ -189,16 +189,30 @@ fn attach_console() {
|
|||
unsafe { AttachConsole(ATTACH_PARENT_PROCESS); }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
#[cfg(target_os = "android")]
|
||||
#[unsafe(no_mangle)]
|
||||
pub fn android_main(app: android_activity::AndroidApp) {
|
||||
use android_activity::WindowManagerFlags;
|
||||
app.set_window_flags(WindowManagerFlags::FULLSCREEN, WindowManagerFlags::empty());
|
||||
kubi_main(app)
|
||||
kubi_main_impl(app);
|
||||
}
|
||||
|
||||
#[cfg(feature = "c-ffi")]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
#[unsafe(no_mangle)]
|
||||
pub fn kubi_main(
|
||||
pub extern "C" fn kubi_main() {
|
||||
// cant let unwinds cross the ffi boundary!
|
||||
// also, hopefully this code should never panic either...
|
||||
let panic = std::panic::catch_unwind(|| {
|
||||
kubi_main_impl();
|
||||
});
|
||||
if panic.is_err() {
|
||||
println!("!!! PANIC CAUGHT ON FFI BOUNDARY !!!");
|
||||
};
|
||||
std::mem::forget(panic); // forget the result, as dropping it will cause unwinding!
|
||||
}
|
||||
|
||||
pub fn kubi_main_impl(
|
||||
#[cfg(target_os = "android")]
|
||||
app: android_activity::AndroidApp
|
||||
) {
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
)]
|
||||
|
||||
fn main() {
|
||||
kubilib::kubi_main();
|
||||
kubilib::kubi_main_impl();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue