use core::{panic::set_panic_hook, repl::setup, splash, workspace}; use colored::Colorize; use tokio::runtime; #[allow(unused_imports)] use tracing::{debug, error, info, warn}; use tracing::{level_filters::LevelFilter, subscriber::set_global_default}; use winit::event_loop::EventLoop; pub mod core; fn init_logger() { let subscriber = tracing_subscriber::fmt() .with_max_level(LevelFilter::DEBUG) .with_level(true) .compact() .pretty() .log_internal_errors(false) .without_time() .with_thread_names(true) .finish(); set_global_default(subscriber).expect("Failed to set default subscriber"); } #[tokio::main(flavor = "current_thread")] async fn main() -> anyhow::Result<()> { init_logger(); if !cfg!(debug_assertions) { info!("{}", "Debug mode disabled".bright_blue()); set_panic_hook(); } set_panic_hook(); setup(); let repl_thread = std::thread::spawn(|| { let rt = runtime::Builder::new_current_thread() .enable_all() .build() .unwrap(); rt.block_on(core::repl::input::handle_repl()) }); let event_loop = EventLoop::new().unwrap(); splash::print_splash(); info!("Type 'help' for a list of commands."); core::render::init_renderer(event_loop); if let Err(_) = repl_thread.join() { eprintln!("REPL thread panicked"); } Ok(()) }