Skip to content

Commit

Permalink
Update to Bevy 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mvlabat committed Apr 9, 2023
1 parent 51745fc commit f077b7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_puffin"
version = "0.3.0"
version = "0.4.0"
authors = ["mvlabat <mvlabat@gmail.com>"]
description = "Integration layer between Bevy, puffin and tracing"
license = "MIT OR Apache-2.0"
Expand All @@ -11,7 +11,7 @@ exclude = [".github/**/*"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.9", default-features = false, features = ["trace"] }
bevy = { version = "0.10", default-features = false, features = ["trace"] }
puffin = "0.14"
tracing-subscriber = {version = "0.3", features = ["registry", "env-filter"]}
tracing-log = "0.1"
Expand All @@ -22,6 +22,6 @@ console_error_panic_hook = "0.1"
tracing-wasm = "0.2"

[dev-dependencies]
bevy = "0.9"
bevy_egui = "0.18"
puffin_egui = "0.19"
bevy = "0.10"
bevy_egui = "0.20"
puffin_egui = "0.20"
6 changes: 3 additions & 3 deletions examples/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bevy::{log::LogPlugin, prelude::*};
use bevy_egui::{EguiContext, EguiPlugin};
use bevy_egui::{EguiContexts, EguiPlugin};
use bevy_puffin::PuffinTracePlugin;

fn main() {
Expand All @@ -11,10 +11,10 @@ fn main() {
.run();
}

fn show_profiler(mut ctx: ResMut<EguiContext>, mut frame_counter: Local<usize>) {
fn show_profiler(mut contexts: EguiContexts, mut frame_counter: Local<usize>) {
puffin::profile_function!();

let ctx = ctx.ctx_mut();
let ctx = contexts.ctx_mut();
puffin_egui::profiler_window(ctx);

std::thread::Builder::new()
Expand Down
19 changes: 9 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
pub use puffin;

use bevy::{
app::{App, Plugin},
ecs::schedule::IntoSystemDescriptor,
app::{App, CoreSet, Plugin},
ecs::schedule::IntoSystemConfig,
log,
log::Level,
utils::tracing::{
Expand Down Expand Up @@ -114,16 +114,15 @@ impl PuffinTracePlugin {
}
}

/// Marks a new frame for the puffin profiler.
pub fn new_frame_system() {
puffin::GlobalProfiler::lock().new_frame();
}

impl Plugin for PuffinTracePlugin {
fn build(&self, app: &mut App) {
if self.init_systems {
app.add_system_to_stage(
bevy::app::CoreStage::First,
(|| {
puffin::GlobalProfiler::lock().new_frame();
})
.at_start(),
);
app.add_system(new_frame_system.in_base_set(CoreSet::First));
}
if self.init_scopes {
puffin::set_scopes_on(true);
Expand Down Expand Up @@ -167,7 +166,7 @@ impl Plugin for PuffinTracePlugin {

match (logger_already_set, subscriber_already_set) {
(true, true) => log::warn!(
"Could not set global logger and tracing subscriber for bevy_puffin as they are already set. Consider disabling LogPlugin or re-ordering plugin initialisation."
"Could not set global logger and tracing subscriber for bevy_puffin as they are already set. Consider disabling LogPlugin or re-ordering plugin initialization."
),
(true, _) => log::warn!("Could not set global logger as it is already set. Consider disabling LogPlugin."),
(_, true) => log::warn!("Could not set global tracing subscriber as it is already set. Consider disabling LogPlugin."),
Expand Down

0 comments on commit f077b7b

Please sign in to comment.