diff --git a/game/Cargo.toml b/game/Cargo.toml index 821b3cf..7e85259 100644 --- a/game/Cargo.toml +++ b/game/Cargo.toml @@ -16,7 +16,7 @@ serde_json = "1.0.64" thiserror = "1.0" chrono = "0.4" rust-embed = "6.2.0" -raylib = "3.5" +raylib = { version = "3.5", git = "https://github.com/ewpratten/raylib-rs", rev = "bdee38594356478a11a95a48b336a97150749334" } puffin = "0.9" puffin_http = "0.6" dirty-fsm = "^0.2.2" @@ -29,7 +29,6 @@ pkg-version = "1.0" cfg-if = "1.0" num-derive = "0.3" num = "0.4" -printf = "0.1" [dev-dependencies] puffin_viewer = "0.6" diff --git a/game/src/lib.rs b/game/src/lib.rs index 3d35e62..26c649d 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -76,10 +76,15 @@ use raylib::prelude::*; use tracing::{error, info}; use utilities::discord::DiscordConfig; -use crate::{context::GameContext, discord_rpc::{maybe_set_discord_presence, try_connect_to_local_discord}, scenes::{build_screen_state_machine, Scenes}, utilities::{ffi_logging::hook_raylib_logging, shaders::{ +use crate::{ + context::GameContext, + discord_rpc::{maybe_set_discord_presence, try_connect_to_local_discord}, + scenes::{build_screen_state_machine, Scenes}, + utilities::shaders::{ shader::ShaderWrapper, util::{dynamic_screen_texture::DynScreenTexture, render_texture::render_to_texture}, - }}}; + }, +}; #[macro_use] extern crate thiserror; @@ -133,7 +138,7 @@ pub async fn game_begin(game_config: &GameConfig) -> Result<(), Box Result<(), Box match level { - RaylibLogLevel::Trace => tracing::trace!("{}", formatted_message), - RaylibLogLevel::Debug => tracing::debug!("{}", formatted_message), - RaylibLogLevel::Warning => tracing::warn!("{}", formatted_message), - RaylibLogLevel::Error => tracing::error!("{}", formatted_message), - RaylibLogLevel::Fatal => tracing::error!("{}", formatted_message), - _ => tracing::info!("{}", formatted_message), - }, - None => { - println!("{:?}", formatted_message) - } - } -} - -/// Call this to replace raylib's logger with the rust logging system -pub fn hook_raylib_logging() { - #[allow(unsafe_code)] - unsafe { - raylib::ffi::SetTraceLogCallback(Some(raylib_log_callback)); - } -} diff --git a/game/src/utilities/mod.rs b/game/src/utilities/mod.rs index f721cf3..1f7c03a 100644 --- a/game/src/utilities/mod.rs +++ b/game/src/utilities/mod.rs @@ -6,4 +6,3 @@ pub mod shaders; pub mod non_ref_raylib; pub mod render_layer; pub mod game_version; -pub mod ffi_logging; diff --git a/wrapper/src/main.rs b/wrapper/src/main.rs index 197c422..e8336c3 100644 --- a/wrapper/src/main.rs +++ b/wrapper/src/main.rs @@ -1,21 +1,15 @@ -use game::{game_begin, GameConfig, StaticGameData}; +use game::{GameConfig, StaticGameData, game_begin}; #[tokio::main] async fn main() { // Enable logging - tracing_subscriber::fmt() - .compact() - .with_thread_names(true) - .with_ansi(true) - .with_max_level(tracing::Level::INFO) - .init(); + tracing_subscriber::fmt::init(); // Load the general config for the game // This happens here so we can properly track sentry events let game_config = GameConfig::load( StaticGameData::get("configs/application.json").expect("Failed to load application.json"), - ) - .unwrap(); + ).unwrap(); // Connect to sentry let _sentry_guard = sentry::init((