小编Sar*_*tta的帖子

如何在 Bevy 中使用 Windowdescriptor?

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .insert_resource(WindowDescriptor{
            width: 140.0,
            height:140.0,
            title: "Game of Life".to_string(),
            ..Default::default()
        })
        .run();
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么这不起作用并且显示以下编译错误

error[E0277]: the trait bound `bevy::prelude::WindowDescriptor: Resource` is not satisfied                                                                                             
   --> src\main.rs:7:26
    |
7   |           .insert_resource(WindowDescriptor{
    |  __________---------------_^
    | |          |
    | |          required by a bound introduced by this call
8   | |             width: 140.0,
9   | |             height:140.0,
10  | |             title: "Game of Life".to_string(),
11  | |             ..Default::default()
12  | |         })
    | |_________^ the trait `Resource` is …
Run Code Online (Sandbox Code Playgroud)

rust bevy

3
推荐指数
2
解决办法
2910
查看次数

标签 统计

bevy ×1

rust ×1