5个版本 (破坏性)
0.6.0 | 2023年8月1日 |
---|---|
0.4.0 | 2022年4月30日 |
0.3.0 | 2022年1月27日 |
0.2.0 | 2021年4月12日 |
0.1.0 | 2021年1月30日 |
#725 in 游戏开发
每月44次下载
450KB
125 行
Bevy诊断叠加层
bevy_screen_diags
为Bevy屏幕添加了非常简单的每秒帧数(FPS)显示。
它受到了https://github.com/bevyengine/bevy/blob/main/examples/ui/text.rs的启发(并从中复制)。
用法
将Crate放入你的Cargo.toml
。
bevy_screen_diags = "0.6.0"
在构建你的App
时包含插件。
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(bevy_screen_diags::ScreenDiagsTextPlugin)
//If a UI camera is already in your game remove the next line
.add_systems(Startup, |mut commands: Commands| {
commands.spawn_bundle(Camera2dBundle::default());
});
}
将你想要使用的字体放入assets/fonts/screen-diags-font.ttf
。如果你想,你可以在本项目中使用该路径下的字体(这是FiraSans-Bold)。
基本的示例只是在一个灰色背景上显示FPS计数,但你可以点击窗口来添加或删除显示。
定制的示例使用ScreenDiagsText
标记组件来调整FPS显示的字体和位置。
欢迎对Crate的贡献。
依赖关系
~18–28MB
~417K SLoC