bevy 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/Cargo.lock +4279 -0
  3. data/Cargo.toml +36 -0
  4. data/README.md +226 -0
  5. data/crates/bevy/Cargo.toml +52 -0
  6. data/crates/bevy/src/app.rs +43 -0
  7. data/crates/bevy/src/component.rs +111 -0
  8. data/crates/bevy/src/entity.rs +30 -0
  9. data/crates/bevy/src/error.rs +32 -0
  10. data/crates/bevy/src/event.rs +190 -0
  11. data/crates/bevy/src/input_bridge.rs +300 -0
  12. data/crates/bevy/src/lib.rs +42 -0
  13. data/crates/bevy/src/mesh_renderer.rs +328 -0
  14. data/crates/bevy/src/query.rs +53 -0
  15. data/crates/bevy/src/render_app.rs +689 -0
  16. data/crates/bevy/src/resource.rs +28 -0
  17. data/crates/bevy/src/schedule.rs +186 -0
  18. data/crates/bevy/src/sprite_renderer.rs +355 -0
  19. data/crates/bevy/src/system.rs +44 -0
  20. data/crates/bevy/src/text_renderer.rs +258 -0
  21. data/crates/bevy/src/types/color.rs +114 -0
  22. data/crates/bevy/src/types/dynamic.rs +131 -0
  23. data/crates/bevy/src/types/math.rs +260 -0
  24. data/crates/bevy/src/types/mod.rs +9 -0
  25. data/crates/bevy/src/types/transform.rs +166 -0
  26. data/crates/bevy/src/world.rs +163 -0
  27. data/crates/bevy_ruby_render/Cargo.toml +22 -0
  28. data/crates/bevy_ruby_render/src/asset.rs +360 -0
  29. data/crates/bevy_ruby_render/src/audio.rs +511 -0
  30. data/crates/bevy_ruby_render/src/camera.rs +365 -0
  31. data/crates/bevy_ruby_render/src/gamepad.rs +398 -0
  32. data/crates/bevy_ruby_render/src/lib.rs +26 -0
  33. data/crates/bevy_ruby_render/src/material.rs +310 -0
  34. data/crates/bevy_ruby_render/src/mesh.rs +491 -0
  35. data/crates/bevy_ruby_render/src/sprite.rs +289 -0
  36. data/ext/bevy/Cargo.toml +20 -0
  37. data/ext/bevy/extconf.rb +6 -0
  38. data/ext/bevy/src/conversions.rs +137 -0
  39. data/ext/bevy/src/lib.rs +29 -0
  40. data/ext/bevy/src/ruby_app.rs +65 -0
  41. data/ext/bevy/src/ruby_color.rs +149 -0
  42. data/ext/bevy/src/ruby_component.rs +189 -0
  43. data/ext/bevy/src/ruby_entity.rs +33 -0
  44. data/ext/bevy/src/ruby_math.rs +384 -0
  45. data/ext/bevy/src/ruby_query.rs +64 -0
  46. data/ext/bevy/src/ruby_render_app.rs +779 -0
  47. data/ext/bevy/src/ruby_system.rs +122 -0
  48. data/ext/bevy/src/ruby_world.rs +107 -0
  49. data/lib/bevy/animation.rb +597 -0
  50. data/lib/bevy/app.rb +675 -0
  51. data/lib/bevy/asset.rb +613 -0
  52. data/lib/bevy/audio.rb +545 -0
  53. data/lib/bevy/audio_effects.rb +224 -0
  54. data/lib/bevy/camera.rb +412 -0
  55. data/lib/bevy/component.rb +91 -0
  56. data/lib/bevy/diagnostics.rb +227 -0
  57. data/lib/bevy/ecs_advanced.rb +296 -0
  58. data/lib/bevy/event.rb +199 -0
  59. data/lib/bevy/gizmos.rb +158 -0
  60. data/lib/bevy/gltf.rb +227 -0
  61. data/lib/bevy/hierarchy.rb +444 -0
  62. data/lib/bevy/input.rb +514 -0
  63. data/lib/bevy/lighting.rb +369 -0
  64. data/lib/bevy/material.rb +248 -0
  65. data/lib/bevy/mesh.rb +257 -0
  66. data/lib/bevy/navigation.rb +344 -0
  67. data/lib/bevy/networking.rb +335 -0
  68. data/lib/bevy/particle.rb +337 -0
  69. data/lib/bevy/physics.rb +396 -0
  70. data/lib/bevy/plugins/default_plugins.rb +34 -0
  71. data/lib/bevy/plugins/input_plugin.rb +49 -0
  72. data/lib/bevy/reflect.rb +361 -0
  73. data/lib/bevy/render_graph.rb +210 -0
  74. data/lib/bevy/resource.rb +185 -0
  75. data/lib/bevy/scene.rb +254 -0
  76. data/lib/bevy/shader.rb +319 -0
  77. data/lib/bevy/shape.rb +195 -0
  78. data/lib/bevy/skeletal.rb +248 -0
  79. data/lib/bevy/sprite.rb +152 -0
  80. data/lib/bevy/sprite_sheet.rb +444 -0
  81. data/lib/bevy/state.rb +277 -0
  82. data/lib/bevy/system.rb +206 -0
  83. data/lib/bevy/text.rb +99 -0
  84. data/lib/bevy/text_advanced.rb +455 -0
  85. data/lib/bevy/timer.rb +147 -0
  86. data/lib/bevy/transform.rb +158 -0
  87. data/lib/bevy/ui.rb +454 -0
  88. data/lib/bevy/ui_advanced.rb +568 -0
  89. data/lib/bevy/version.rb +5 -0
  90. data/lib/bevy/visibility.rb +250 -0
  91. data/lib/bevy/window.rb +302 -0
  92. data/lib/bevy.rb +390 -0
  93. metadata +150 -0
@@ -0,0 +1,260 @@
1
+ use bevy_math::{Quat, Vec2, Vec3};
2
+
3
+ #[derive(Debug, Clone, Copy, PartialEq)]
4
+ pub struct RubyVec2(pub Vec2);
5
+
6
+ impl RubyVec2 {
7
+ pub fn new(x: f32, y: f32) -> Self {
8
+ Self(Vec2::new(x, y))
9
+ }
10
+
11
+ pub fn zero() -> Self {
12
+ Self(Vec2::ZERO)
13
+ }
14
+
15
+ pub fn one() -> Self {
16
+ Self(Vec2::ONE)
17
+ }
18
+
19
+ pub fn x(&self) -> f32 {
20
+ self.0.x
21
+ }
22
+
23
+ pub fn y(&self) -> f32 {
24
+ self.0.y
25
+ }
26
+
27
+ pub fn set_x(&mut self, x: f32) {
28
+ self.0.x = x;
29
+ }
30
+
31
+ pub fn set_y(&mut self, y: f32) {
32
+ self.0.y = y;
33
+ }
34
+
35
+ pub fn length(&self) -> f32 {
36
+ self.0.length()
37
+ }
38
+
39
+ pub fn length_squared(&self) -> f32 {
40
+ self.0.length_squared()
41
+ }
42
+
43
+ pub fn normalize(&self) -> Self {
44
+ Self(self.0.normalize())
45
+ }
46
+
47
+ pub fn dot(&self, other: &RubyVec2) -> f32 {
48
+ self.0.dot(other.0)
49
+ }
50
+
51
+ pub fn add(&self, other: &RubyVec2) -> Self {
52
+ Self(self.0 + other.0)
53
+ }
54
+
55
+ pub fn sub(&self, other: &RubyVec2) -> Self {
56
+ Self(self.0 - other.0)
57
+ }
58
+
59
+ pub fn mul(&self, scalar: f32) -> Self {
60
+ Self(self.0 * scalar)
61
+ }
62
+
63
+ pub fn div(&self, scalar: f32) -> Self {
64
+ Self(self.0 / scalar)
65
+ }
66
+
67
+ pub fn distance(&self, other: &RubyVec2) -> f32 {
68
+ self.0.distance(other.0)
69
+ }
70
+
71
+ pub fn inner(&self) -> Vec2 {
72
+ self.0
73
+ }
74
+ }
75
+
76
+ impl From<Vec2> for RubyVec2 {
77
+ fn from(v: Vec2) -> Self {
78
+ Self(v)
79
+ }
80
+ }
81
+
82
+ impl From<RubyVec2> for Vec2 {
83
+ fn from(v: RubyVec2) -> Self {
84
+ v.0
85
+ }
86
+ }
87
+
88
+ #[derive(Debug, Clone, Copy, PartialEq)]
89
+ pub struct RubyVec3(pub Vec3);
90
+
91
+ impl RubyVec3 {
92
+ pub fn new(x: f32, y: f32, z: f32) -> Self {
93
+ Self(Vec3::new(x, y, z))
94
+ }
95
+
96
+ pub fn zero() -> Self {
97
+ Self(Vec3::ZERO)
98
+ }
99
+
100
+ pub fn one() -> Self {
101
+ Self(Vec3::ONE)
102
+ }
103
+
104
+ pub fn x(&self) -> f32 {
105
+ self.0.x
106
+ }
107
+
108
+ pub fn y(&self) -> f32 {
109
+ self.0.y
110
+ }
111
+
112
+ pub fn z(&self) -> f32 {
113
+ self.0.z
114
+ }
115
+
116
+ pub fn set_x(&mut self, x: f32) {
117
+ self.0.x = x;
118
+ }
119
+
120
+ pub fn set_y(&mut self, y: f32) {
121
+ self.0.y = y;
122
+ }
123
+
124
+ pub fn set_z(&mut self, z: f32) {
125
+ self.0.z = z;
126
+ }
127
+
128
+ pub fn length(&self) -> f32 {
129
+ self.0.length()
130
+ }
131
+
132
+ pub fn length_squared(&self) -> f32 {
133
+ self.0.length_squared()
134
+ }
135
+
136
+ pub fn normalize(&self) -> Self {
137
+ Self(self.0.normalize())
138
+ }
139
+
140
+ pub fn dot(&self, other: &RubyVec3) -> f32 {
141
+ self.0.dot(other.0)
142
+ }
143
+
144
+ pub fn cross(&self, other: &RubyVec3) -> Self {
145
+ Self(self.0.cross(other.0))
146
+ }
147
+
148
+ pub fn add(&self, other: &RubyVec3) -> Self {
149
+ Self(self.0 + other.0)
150
+ }
151
+
152
+ pub fn sub(&self, other: &RubyVec3) -> Self {
153
+ Self(self.0 - other.0)
154
+ }
155
+
156
+ pub fn mul(&self, scalar: f32) -> Self {
157
+ Self(self.0 * scalar)
158
+ }
159
+
160
+ pub fn div(&self, scalar: f32) -> Self {
161
+ Self(self.0 / scalar)
162
+ }
163
+
164
+ pub fn distance(&self, other: &RubyVec3) -> f32 {
165
+ self.0.distance(other.0)
166
+ }
167
+
168
+ pub fn inner(&self) -> Vec3 {
169
+ self.0
170
+ }
171
+ }
172
+
173
+ impl From<Vec3> for RubyVec3 {
174
+ fn from(v: Vec3) -> Self {
175
+ Self(v)
176
+ }
177
+ }
178
+
179
+ impl From<RubyVec3> for Vec3 {
180
+ fn from(v: RubyVec3) -> Self {
181
+ v.0
182
+ }
183
+ }
184
+
185
+ #[derive(Debug, Clone, Copy, PartialEq)]
186
+ pub struct RubyQuat(pub Quat);
187
+
188
+ impl RubyQuat {
189
+ pub fn identity() -> Self {
190
+ Self(Quat::IDENTITY)
191
+ }
192
+
193
+ pub fn from_axis_angle(axis: &RubyVec3, angle: f32) -> Self {
194
+ Self(Quat::from_axis_angle(axis.0, angle))
195
+ }
196
+
197
+ pub fn from_euler(x: f32, y: f32, z: f32) -> Self {
198
+ Self(Quat::from_euler(bevy_math::EulerRot::XYZ, x, y, z))
199
+ }
200
+
201
+ pub fn from_rotation_x(angle: f32) -> Self {
202
+ Self(Quat::from_rotation_x(angle))
203
+ }
204
+
205
+ pub fn from_rotation_y(angle: f32) -> Self {
206
+ Self(Quat::from_rotation_y(angle))
207
+ }
208
+
209
+ pub fn from_rotation_z(angle: f32) -> Self {
210
+ Self(Quat::from_rotation_z(angle))
211
+ }
212
+
213
+ pub fn x(&self) -> f32 {
214
+ self.0.x
215
+ }
216
+
217
+ pub fn y(&self) -> f32 {
218
+ self.0.y
219
+ }
220
+
221
+ pub fn z(&self) -> f32 {
222
+ self.0.z
223
+ }
224
+
225
+ pub fn w(&self) -> f32 {
226
+ self.0.w
227
+ }
228
+
229
+ pub fn normalize(&self) -> Self {
230
+ Self(self.0.normalize())
231
+ }
232
+
233
+ pub fn inverse(&self) -> Self {
234
+ Self(self.0.inverse())
235
+ }
236
+
237
+ pub fn mul(&self, other: &RubyQuat) -> Self {
238
+ Self(self.0 * other.0)
239
+ }
240
+
241
+ pub fn mul_vec3(&self, v: &RubyVec3) -> RubyVec3 {
242
+ RubyVec3(self.0 * v.0)
243
+ }
244
+
245
+ pub fn inner(&self) -> Quat {
246
+ self.0
247
+ }
248
+ }
249
+
250
+ impl From<Quat> for RubyQuat {
251
+ fn from(q: Quat) -> Self {
252
+ Self(q)
253
+ }
254
+ }
255
+
256
+ impl From<RubyQuat> for Quat {
257
+ fn from(q: RubyQuat) -> Self {
258
+ q.0
259
+ }
260
+ }
@@ -0,0 +1,9 @@
1
+ pub mod color;
2
+ pub mod dynamic;
3
+ pub mod math;
4
+ pub mod transform;
5
+
6
+ pub use color::RubyColor;
7
+ pub use dynamic::{DynamicComponent, DynamicComponents, DynamicValue};
8
+ pub use math::{RubyQuat, RubyVec2, RubyVec3};
9
+ pub use transform::RubyTransform;
@@ -0,0 +1,166 @@
1
+ use bevy_math::{Quat, Vec3};
2
+ use bevy_transform::components::Transform;
3
+ use crate::types::math::{RubyQuat, RubyVec3};
4
+
5
+ #[derive(Debug, Clone, Copy, PartialEq)]
6
+ pub struct RubyTransform(pub Transform);
7
+
8
+ impl RubyTransform {
9
+ pub fn new() -> Self {
10
+ Self(Transform::IDENTITY)
11
+ }
12
+
13
+ pub fn from_translation(translation: RubyVec3) -> Self {
14
+ Self(Transform::from_translation(translation.inner()))
15
+ }
16
+
17
+ pub fn from_xyz(x: f32, y: f32, z: f32) -> Self {
18
+ Self(Transform::from_xyz(x, y, z))
19
+ }
20
+
21
+ pub fn from_rotation(rotation: RubyQuat) -> Self {
22
+ Self(Transform::from_rotation(rotation.inner()))
23
+ }
24
+
25
+ pub fn from_scale(scale: RubyVec3) -> Self {
26
+ Self(Transform::from_scale(scale.inner()))
27
+ }
28
+
29
+ pub fn from_translation_rotation(translation: RubyVec3, rotation: RubyQuat) -> Self {
30
+ Self(Transform {
31
+ translation: translation.inner(),
32
+ rotation: rotation.inner(),
33
+ scale: Vec3::ONE,
34
+ })
35
+ }
36
+
37
+ pub fn from_translation_rotation_scale(
38
+ translation: RubyVec3,
39
+ rotation: RubyQuat,
40
+ scale: RubyVec3,
41
+ ) -> Self {
42
+ Self(Transform {
43
+ translation: translation.inner(),
44
+ rotation: rotation.inner(),
45
+ scale: scale.inner(),
46
+ })
47
+ }
48
+
49
+ pub fn identity() -> Self {
50
+ Self(Transform::IDENTITY)
51
+ }
52
+
53
+ pub fn translation(&self) -> RubyVec3 {
54
+ RubyVec3::from(self.0.translation)
55
+ }
56
+
57
+ pub fn rotation(&self) -> RubyQuat {
58
+ RubyQuat::from(self.0.rotation)
59
+ }
60
+
61
+ pub fn scale(&self) -> RubyVec3 {
62
+ RubyVec3::from(self.0.scale)
63
+ }
64
+
65
+ pub fn set_translation(&mut self, translation: RubyVec3) {
66
+ self.0.translation = translation.inner();
67
+ }
68
+
69
+ pub fn set_rotation(&mut self, rotation: RubyQuat) {
70
+ self.0.rotation = rotation.inner();
71
+ }
72
+
73
+ pub fn set_scale(&mut self, scale: RubyVec3) {
74
+ self.0.scale = scale.inner();
75
+ }
76
+
77
+ pub fn translate(&mut self, delta: RubyVec3) {
78
+ self.0.translation += delta.inner();
79
+ }
80
+
81
+ pub fn rotate(&mut self, rotation: RubyQuat) {
82
+ self.0.rotation = rotation.inner() * self.0.rotation;
83
+ }
84
+
85
+ pub fn rotate_x(&mut self, angle: f32) {
86
+ self.0.rotate_x(angle);
87
+ }
88
+
89
+ pub fn rotate_y(&mut self, angle: f32) {
90
+ self.0.rotate_y(angle);
91
+ }
92
+
93
+ pub fn rotate_z(&mut self, angle: f32) {
94
+ self.0.rotate_z(angle);
95
+ }
96
+
97
+ pub fn rotate_local_x(&mut self, angle: f32) {
98
+ self.0.rotate_local_x(angle);
99
+ }
100
+
101
+ pub fn rotate_local_y(&mut self, angle: f32) {
102
+ self.0.rotate_local_y(angle);
103
+ }
104
+
105
+ pub fn rotate_local_z(&mut self, angle: f32) {
106
+ self.0.rotate_local_z(angle);
107
+ }
108
+
109
+ pub fn look_at(&mut self, target: RubyVec3, up: RubyVec3) {
110
+ self.0.look_at(target.inner(), up.inner());
111
+ }
112
+
113
+ pub fn forward(&self) -> RubyVec3 {
114
+ RubyVec3::from(*self.0.forward())
115
+ }
116
+
117
+ pub fn back(&self) -> RubyVec3 {
118
+ RubyVec3::from(*self.0.back())
119
+ }
120
+
121
+ pub fn left(&self) -> RubyVec3 {
122
+ RubyVec3::from(*self.0.left())
123
+ }
124
+
125
+ pub fn right(&self) -> RubyVec3 {
126
+ RubyVec3::from(*self.0.right())
127
+ }
128
+
129
+ pub fn up(&self) -> RubyVec3 {
130
+ RubyVec3::from(*self.0.up())
131
+ }
132
+
133
+ pub fn down(&self) -> RubyVec3 {
134
+ RubyVec3::from(*self.0.down())
135
+ }
136
+
137
+ pub fn mul(&self, other: &RubyTransform) -> Self {
138
+ Self(self.0 * other.0)
139
+ }
140
+
141
+ pub fn transform_point(&self, point: RubyVec3) -> RubyVec3 {
142
+ RubyVec3::from(self.0.transform_point(point.inner()))
143
+ }
144
+
145
+ pub fn inner(&self) -> Transform {
146
+ self.0
147
+ }
148
+ }
149
+
150
+ impl Default for RubyTransform {
151
+ fn default() -> Self {
152
+ Self::new()
153
+ }
154
+ }
155
+
156
+ impl From<Transform> for RubyTransform {
157
+ fn from(t: Transform) -> Self {
158
+ Self(t)
159
+ }
160
+ }
161
+
162
+ impl From<RubyTransform> for Transform {
163
+ fn from(t: RubyTransform) -> Self {
164
+ t.0
165
+ }
166
+ }
@@ -0,0 +1,163 @@
1
+ use crate::component::ComponentRegistry;
2
+ use crate::entity::EntityWrapper;
3
+ use crate::error::BevyRubyError;
4
+ use crate::types::{DynamicComponent, DynamicComponents};
5
+ use bevy_ecs::world::World;
6
+ use std::cell::RefCell;
7
+ use std::sync::Arc;
8
+
9
+ pub struct WorldWrapper {
10
+ world: RefCell<World>,
11
+ registry: Arc<ComponentRegistry>,
12
+ }
13
+
14
+ impl WorldWrapper {
15
+ pub fn new() -> Self {
16
+ Self {
17
+ world: RefCell::new(World::new()),
18
+ registry: ComponentRegistry::new(),
19
+ }
20
+ }
21
+
22
+ pub fn with_registry(registry: Arc<ComponentRegistry>) -> Self {
23
+ Self {
24
+ world: RefCell::new(World::new()),
25
+ registry,
26
+ }
27
+ }
28
+
29
+ pub fn spawn(&self) -> EntityWrapper {
30
+ let entity = self.world.borrow_mut().spawn_empty().id();
31
+ EntityWrapper::new(entity)
32
+ }
33
+
34
+ pub fn spawn_with_component(&self, component: DynamicComponent) -> EntityWrapper {
35
+ let mut components = DynamicComponents::new();
36
+ components.add(component);
37
+ let entity = self.world.borrow_mut().spawn(components).id();
38
+ EntityWrapper::new(entity)
39
+ }
40
+
41
+ pub fn spawn_with_components(&self, component_list: Vec<DynamicComponent>) -> EntityWrapper {
42
+ let mut components = DynamicComponents::new();
43
+ for component in component_list {
44
+ components.add(component);
45
+ }
46
+ let entity = self.world.borrow_mut().spawn(components).id();
47
+ EntityWrapper::new(entity)
48
+ }
49
+
50
+ pub fn despawn(&self, entity: EntityWrapper) -> Result<(), BevyRubyError> {
51
+ let mut world = self.world.borrow_mut();
52
+ if world.get_entity(entity.inner()).is_ok() {
53
+ world.despawn(entity.inner());
54
+ Ok(())
55
+ } else {
56
+ Err(BevyRubyError::EntityNotFound(entity.inner()))
57
+ }
58
+ }
59
+
60
+ pub fn entity_exists(&self, entity: EntityWrapper) -> bool {
61
+ self.world.borrow().get_entity(entity.inner()).is_ok()
62
+ }
63
+
64
+ pub fn insert_component(
65
+ &self,
66
+ entity: EntityWrapper,
67
+ component: DynamicComponent,
68
+ ) -> Result<(), BevyRubyError> {
69
+ let mut world = self.world.borrow_mut();
70
+ match world.get_entity_mut(entity.inner()) {
71
+ Ok(mut entity_mut) => {
72
+ if let Some(mut components) = entity_mut.get_mut::<DynamicComponents>() {
73
+ components.add(component);
74
+ } else {
75
+ let mut components = DynamicComponents::new();
76
+ components.add(component);
77
+ entity_mut.insert(components);
78
+ }
79
+ Ok(())
80
+ }
81
+ Err(_) => Err(BevyRubyError::EntityNotFound(entity.inner())),
82
+ }
83
+ }
84
+
85
+ pub fn get_component(
86
+ &self,
87
+ entity: EntityWrapper,
88
+ type_name: &str,
89
+ ) -> Result<DynamicComponent, BevyRubyError> {
90
+ let world = self.world.borrow();
91
+ match world.get_entity(entity.inner()) {
92
+ Ok(entity_ref) => {
93
+ if let Some(components) = entity_ref.get::<DynamicComponents>() {
94
+ components.get(type_name).cloned().ok_or_else(|| {
95
+ BevyRubyError::ComponentNotFound {
96
+ entity: entity.inner(),
97
+ component: type_name.to_string(),
98
+ }
99
+ })
100
+ } else {
101
+ Err(BevyRubyError::ComponentNotFound {
102
+ entity: entity.inner(),
103
+ component: type_name.to_string(),
104
+ })
105
+ }
106
+ }
107
+ Err(_) => Err(BevyRubyError::EntityNotFound(entity.inner())),
108
+ }
109
+ }
110
+
111
+ pub fn has_component(&self, entity: EntityWrapper, type_name: &str) -> bool {
112
+ let world = self.world.borrow();
113
+ match world.get_entity(entity.inner()) {
114
+ Ok(entity_ref) => {
115
+ if let Some(components) = entity_ref.get::<DynamicComponents>() {
116
+ components.has(type_name)
117
+ } else {
118
+ false
119
+ }
120
+ }
121
+ Err(_) => false,
122
+ }
123
+ }
124
+
125
+ pub fn query_entities_with(&self, type_names: &[&str]) -> Vec<EntityWrapper> {
126
+ let world = self.world.borrow();
127
+ let mut result = Vec::new();
128
+
129
+ for entity in world.iter_entities() {
130
+ if let Some(components) = entity.get::<DynamicComponents>() {
131
+ if components.has_all(type_names) {
132
+ result.push(EntityWrapper::new(entity.id()));
133
+ }
134
+ }
135
+ }
136
+
137
+ result
138
+ }
139
+
140
+ pub fn registry(&self) -> &Arc<ComponentRegistry> {
141
+ &self.registry
142
+ }
143
+
144
+ pub fn with_world<F, R>(&self, f: F) -> R
145
+ where
146
+ F: FnOnce(&World) -> R,
147
+ {
148
+ f(&self.world.borrow())
149
+ }
150
+
151
+ pub fn with_world_mut<F, R>(&self, f: F) -> R
152
+ where
153
+ F: FnOnce(&mut World) -> R,
154
+ {
155
+ f(&mut self.world.borrow_mut())
156
+ }
157
+ }
158
+
159
+ impl Default for WorldWrapper {
160
+ fn default() -> Self {
161
+ Self::new()
162
+ }
163
+ }
@@ -0,0 +1,22 @@
1
+ [package]
2
+ name = "bevy-ruby-render"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+ repository.workspace = true
7
+
8
+ [dependencies]
9
+ bevy_ecs.workspace = true
10
+ bevy_app.workspace = true
11
+ bevy_math.workspace = true
12
+ bevy_transform.workspace = true
13
+ bevy_color.workspace = true
14
+ bevy_render = { workspace = true }
15
+ bevy_sprite = { workspace = true }
16
+ bevy_window.workspace = true
17
+ bevy_core_pipeline = { workspace = true }
18
+ bevy_asset.workspace = true
19
+ bevy_hierarchy.workspace = true
20
+ bevy_image.workspace = true
21
+ bevy_text = { workspace = true }
22
+ bevy_prototype_lyon.workspace = true