File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed
tests-integration/simple-ecs-test/src Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ keywords = ["bevy"]
1212syn = " 2.0"
1313quote = " 1.0"
1414proc-macro2 = " 1.0"
15- cargo-manifest-proc-macros = " 0.3.1 "
15+ cargo-manifest-proc-macros = " 0.3.2 "
1616
1717[lints ]
1818workspace = true
Original file line number Diff line number Diff line change 22use bevy:: prelude:: * ;
33
44#[ derive( Component ) ]
5- struct _Component {
6- _value : f32 ,
5+ struct MyComponent {
6+ value : f32 ,
77}
88
99#[ derive( Resource ) ]
10- struct _Resource {
11- _value : f32 ,
10+ struct MyResource {
11+ value : f32 ,
1212}
1313
14- fn hello_world ( ) {
15- println ! ( "hello world!" ) ;
14+ fn hello_world ( query : Query < & MyComponent > , resource : Res < MyResource > ) {
15+ let component = query. iter ( ) . next ( ) . unwrap ( ) ;
16+ let comp_value = component. value ; // suggestions work
17+ let res_value_deref = resource. value ; // suggestions don't work but ctrl+click works once it's written, also type inlay hints work correctly
18+ let res_value_direct = resource. into_inner ( ) . value ; // suggestions work
19+ println ! (
20+ "hello world! Value: {} {} {}" ,
21+ comp_value, res_value_deref, res_value_direct
22+ ) ;
23+ }
24+
25+ fn spawn_component ( mut commands : Commands ) {
26+ commands. spawn ( MyComponent { value : 10.0 } ) ;
1627}
1728
1829#[ test]
1930fn simple_ecs_test ( ) {
20- App :: new ( ) . add_systems ( Update , hello_world) . run ( ) ;
31+ App :: new ( )
32+ . insert_resource ( MyResource { value : 5.0 } )
33+ . add_systems ( Startup , spawn_component)
34+ . add_systems ( Update , hello_world)
35+ . run ( ) ;
2136}
You can’t perform that action at this time.
0 commit comments