#[macro_export]
#[cfg(not(target_os = "android"))]
macro_rules! start {
($App:ident) => {
fn main() {
use vrust::system::application::Application as SysApp;
let mut app = Box::new(SysApp::<$App>::new());
app.run();
}
};
}
#[macro_export]
#[cfg(target_os = "android")]
macro_rules! start {
($App:ident) => {
#[allow(dead_code, non_snake_case)]
#[no_mangle]
pub unsafe extern fn ANativeActivity_onCreate(
activity: *mut vrust::system::android::activity::ANativeActivity,
saved_state: *mut std::os::raw::c_void,
saved_state_size: usize) {
use std::mem::transmute;
use vrust::system::application::Application as SysApp;
SysApp::<$App>::new(activity, transmute(saved_state), transmute(saved_state_size));
}
};
}
#[macro_export]
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
macro_rules! logi {
($fmt:expr) => {
print!("vrust Information MSG in file: {} line: {} ", file!(), line!());
println!($fmt);
};
($fmt:expr, $($arg:tt)*) => {
print!("vrust Information MSG in file: {} line: {} ", file!(), line!());
println!($fmt, $($arg)*);
};
}
#[macro_export]
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
macro_rules! loge {
($fmt:expr) => {
print!("vrust Error MSG in file: {} line: {} ", file!(), line!());
println!($fmt);
};
($fmt:expr, $($arg:tt)*) => {
print!("vrust Error MSG in file: {} line: {} ", file!(), line!());
println!($fmt, $($arg)*);
};
}
#[macro_export]
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
macro_rules! logf {
($fmt:expr) => {
print!("vrust Fatal MSG in file: {} line: {} ", file!(), line!());
panic!($fmt);
};
($fmt:expr, $($arg:tt)*) => {
print!("vrust Fatal MSG in file: {} line: {} ", file!(), line!());
panic!($fmt, $($arg)*);
};
}
#[macro_export]
#[cfg(target_os = "android")]
macro_rules! logi {
($fmt:expr) => {
let s = format!(
"vrust Information MSG in file: {} line: {} {}", file!(), line!(), format!($fmt));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Info, &s);
};
($fmt:expr, $($arg:tt)*) => {
let s = format!(
"vrust Information MSG in file: {} line: {} {}", file!(), line!(),
format!($fmt, $($arg)*));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Info, &s);
};
}
#[macro_export]
#[cfg(target_os = "android")]
macro_rules! loge {
($fmt:expr) => {
let s = format!(
"vrust Error MSG in file: {} line: {} {}", file!(), line!(), format!($fmt));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Error, &s);
};
($fmt:expr, $($arg:tt)*) => {
let s = format!(
"vrust Error MSG in file: {} line: {} {}", file!(), line!(),
format!($fmt, $($arg)*));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Error, &s);
};
}
#[macro_export]
#[cfg(target_os = "android")]
macro_rules! logf {
($fmt:expr) => {
let s = format!(
"vrust Fatal MSG in file: {} line: {} {}", file!(), line!(), format!($fmt));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Fatal, &s);
panic!("Terminated!");
};
($fmt:expr, $($arg:tt)*) => {
let s = format!("vrust Fatal MSG in file: {} line: {} {}", file!(), line!(),
format!($fmt, $($arg)*));
$crate::system::android::log::print(
$crate::system::android::log::Priority::Fatal, &s);
panic!("Terminated!");
};
}