Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bevy 0.13 #1

Open
wants to merge 6 commits into
base: update-to-bevy-0.13
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
12 changes: 6 additions & 6 deletions src/debug.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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");

Expand Down
22 changes: 12 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
}
Expand Down