#![allow(clippy::type_complexity)]

#[macro_use]
extern crate common;

extern crate simulation;

#[allow(unused_imports)]
#[macro_use]
extern crate inline_tweak;

#[macro_use]
mod uiworld;

mod audio;
mod debug_gui;
mod game_loop;
mod gui;
mod init;
mod inputmap;
#[cfg(target_os = "android")]
mod mobile;
mod network;
mod rendering;

fn initialize_game() {
    #[cfg(feature = "profile")]
    profiling::tracy_client::Client::start();
    profiling::register_thread!("Main Thread");
    engine::framework::init();
    init::init();
}

#[cfg(not(target_os = "android"))]
pub fn run_desktop() {
    initialize_game();
    engine::framework::start::<game_loop::State>();
}

#[cfg(target_os = "android")]
#[no_mangle]
pub fn android_main(app: winit::platform::android::activity::AndroidApp) {
    mobile::initialize_android(&app);
    initialize_game();
    engine::framework::start_android::<game_loop::State>(app);
}
