diff --git a/Cargo.toml b/Cargo.toml index 10b607b..ffdd421 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_framepace" -version = "0.14.1" +version = "0.15.0" edition = "2021" resolver = "2" description = "Frame pacing and frame limiting for Bevy" @@ -11,21 +11,39 @@ documentation = "https://docs.rs/bevy_framepace" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { version = "0.12", default-features = false, features = [ - "bevy_render", - "bevy_winit", -] } +bevy_app = "0.13" +bevy_ecs = "0.13" +bevy_diagnostic = "0.13" +bevy_log = "0.13" +bevy_render = "0.13" +bevy_reflect = "0.13" +bevy_time = "0.13" +bevy_utils = "0.13" +bevy_window = "0.13" +bevy_winit = "0.13" +# Non-bevy spin_sleep = "1.0" [features] -default = ["framepace_debug", "bevy/x11"] +default = ["framepace_debug", "bevy_winit/x11"] framepace_debug = [] [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = [ +bevy = { version = "0.13", default-features = false, features = [ "bevy_gizmos", "bevy_text", "bevy_ui", "default_font", "multi-threaded", + "x11", ] } + +[[example]] +name = "demo" +path = "examples/demo.rs" +required-features = ["default"] + +[[example]] +name = "minimal" +path = "examples/minimal.rs" +required-features = ["default"] diff --git a/README.md b/README.md index 122a10d..2e0f0d2 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ I intend to track the `main` branch of Bevy. PRs supporting this are welcome! | bevy | bevy_framepace | | ---- | ------------------- | +| 0.13 | 0.15 | | 0.12 | 0.14 | | 0.11 | 0.13 | | 0.10 | 0.12 | diff --git a/src/debug.rs b/src/debug.rs index ab6447f..13bcc46 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,9 +1,9 @@ //! Adds diagnostic logging and a cursor for debugging. -use bevy::{ - diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic}, - prelude::*, -}; +use bevy_app::prelude::*; +use bevy_diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic}; +use bevy_ecs::prelude::*; +use bevy_time::prelude::*; /// Adds [`Diagnostics`] data from `bevy_framepace` pub struct DiagnosticsPlugin; @@ -18,10 +18,10 @@ impl Plugin for DiagnosticsPlugin { } impl DiagnosticsPlugin { - /// [`DiagnosticId`] for the frametime + /// [`DiagnosticPath`] for the frametime pub const FRAMEPACE_FRAMETIME: DiagnosticPath = DiagnosticPath::const_new("framepace/frametime"); - /// [`DiagnosticId`] for failures to meet frame time target + /// [`DiagnosticPath`] for failures to meet frame time target pub const FRAMEPACE_OVERSLEEP: DiagnosticPath = DiagnosticPath::const_new("framepace/oversleep"); diff --git a/src/lib.rs b/src/lib.rs index fa65274..a37600e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -//! This is a [`bevy`] plugin that adds framepacing and framelimiting to improve input latency and +//! This is a `bevy` plugin that adds framepacing and framelimiting to improve input latency and //! power use. //! //! # How it works @@ -27,13 +27,15 @@ #![deny(missing_docs)] +use bevy_app::prelude::*; +use bevy_ecs::prelude::*; +use bevy_reflect::prelude::*; +use bevy_render::{pipelined_rendering::RenderExtractApp, Render, RenderApp, RenderSet}; +use bevy_utils::Instant; +use bevy_window::prelude::*; + #[cfg(not(target_arch = "wasm32"))] -use bevy::winit::WinitWindows; -use bevy::{ - prelude::*, - render::{pipelined_rendering::RenderExtractApp, RenderApp, RenderSet}, - utils::Instant, -}; +use bevy_winit::WinitWindows; use std::{ sync::{Arc, Mutex}, @@ -78,7 +80,7 @@ impl Plugin for FramepacePlugin { .insert_resource(limit) .insert_resource(stats) .add_systems( - bevy::render::Render, + Render, framerate_limiter .in_set(RenderSet::Cleanup) .after(World::clear_entities), @@ -199,7 +201,7 @@ fn get_display_refresh_rate( Limiter::Off => { #[cfg(feature = "framepace_debug")] if settings.is_changed() { - info!("Frame limiter disabled"); + bevy_log::info!("Frame limiter disabled"); } return; } @@ -208,7 +210,7 @@ fn get_display_refresh_rate( if let Ok(mut limit) = frame_limit.0.try_lock() { if new_frametime != *limit { #[cfg(feature = "framepace_debug")] - info!("Frametime limit changed to: {:?}", new_frametime); + bevy_log::info!("Frametime limit changed to: {:?}", new_frametime); *limit = new_frametime; } }