forked from nonsensical-dev/zenyx-engine
improve error handling and add metadata
This commit is contained in:
parent
10932a1a97
commit
710c8e52bd
17 changed files with 1162 additions and 787 deletions
|
@ -1,5 +1,5 @@
|
|||
use core::{panic::set_panic_hook, repl::setup, splash, workspace};
|
||||
|
||||
use core::{panic::set_panic_hook, repl::setup, splash};
|
||||
use thiserror::Error;
|
||||
use colored::Colorize;
|
||||
use tokio::runtime;
|
||||
#[allow(unused_imports)]
|
||||
|
@ -7,6 +7,8 @@ use tracing::{debug, error, info, warn};
|
|||
use tracing::{level_filters::LevelFilter, subscriber::set_global_default};
|
||||
use winit::event_loop::EventLoop;
|
||||
pub mod core;
|
||||
pub mod error;
|
||||
pub mod metadata;
|
||||
|
||||
fn init_logger() {
|
||||
let subscriber = tracing_subscriber::fmt()
|
||||
|
@ -23,15 +25,26 @@ fn init_logger() {
|
|||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
async fn main() {
|
||||
init_logger();
|
||||
if !cfg!(debug_assertions) {
|
||||
info!("{}", "Debug mode disabled".bright_blue());
|
||||
set_panic_hook();
|
||||
}
|
||||
let sysinfo = crate::metadata::SystemMetadata::current();
|
||||
|
||||
|
||||
set_panic_hook();
|
||||
setup();
|
||||
|
||||
|
||||
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
splash::print_splash();
|
||||
if !cfg!(debug_assertions) {
|
||||
info!("{}", "Debug mode disabled".bright_blue());
|
||||
set_panic_hook();
|
||||
} else {
|
||||
println!("{}",sysinfo.verbose_summary());
|
||||
}
|
||||
|
||||
info!("Type 'help' for a list of commands.");
|
||||
let repl_thread = std::thread::spawn(|| {
|
||||
let rt = runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
|
@ -39,14 +52,9 @@ async fn main() -> anyhow::Result<()> {
|
|||
.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");
|
||||
error!("REPL thread panicked");
|
||||
}
|
||||
Ok(())
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue