@@ -78,18 +78,18 @@ pub struct WorldOwnerExclusive {
78
78
world : World < f32 >
79
79
}
80
80
81
- impl WorldOwnerExclusive {
82
- pub fn new ( world : World < f32 > ) -> WorldOwnerExclusive {
83
- WorldOwnerExclusive { world}
84
- }
85
- }
86
-
87
81
impl WorldOwner for WorldOwnerExclusive {
88
82
fn get_mut < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > {
89
83
Box :: new ( & mut self . world )
90
84
}
91
85
}
92
86
87
+ impl From < World < f32 > > for WorldOwnerExclusive {
88
+ fn from ( world : World < f32 > ) -> Self {
89
+ WorldOwnerExclusive { world}
90
+ }
91
+ }
92
+
93
93
pub struct Testbed {
94
94
window : Option < Box < Window > > ,
95
95
graphics : GraphicsManager ,
@@ -136,10 +136,13 @@ impl Testbed {
136
136
}
137
137
}
138
138
139
- pub fn new ( world : Box < WorldOwner > ) -> Testbed {
139
+ pub fn new ( world : World < f32 > ) -> Testbed {
140
+ Testbed :: new_with_world_owner ( Box :: new ( WorldOwnerExclusive :: from ( world) ) )
141
+ }
142
+ pub fn new_with_world_owner ( world_owner : Box < WorldOwner > ) -> Testbed {
140
143
let mut res = Testbed :: new_empty ( ) ;
141
144
142
- res. set_world ( world ) ;
145
+ res. set_world_owner ( world_owner ) ;
143
146
144
147
res
145
148
}
@@ -156,7 +159,11 @@ impl Testbed {
156
159
self . hide_counters = false ;
157
160
}
158
161
159
- pub fn set_world ( & mut self , world : Box < WorldOwner > ) {
162
+ pub fn set_world ( & mut self , world : World < f32 > ) {
163
+ self . set_world_owner ( Box :: new ( WorldOwnerExclusive :: from ( world) ) ) ;
164
+ }
165
+
166
+ pub fn set_world_owner ( & mut self , world : Box < WorldOwner > ) {
160
167
self . world = world;
161
168
let mut world = self . world . get_mut ( ) ;
162
169
world. enable_performance_counters ( ) ;
0 commit comments