Replace Contexts with Resources #7
1 changed files with 3 additions and 1 deletions
|
|
@ -65,8 +65,9 @@ impl System for RenderingTestSystem {
|
|||
}
|
||||
|
||||
fn frame_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let pctx = res.get::<PlatformContext>().unwrap().clone();
|
||||
let pctx = res.get::<PlatformContext>().unwrap();
|
||||
let dbg_ui = scene.resources.get_mut::<DebugUIBuffer>().unwrap();
|
||||
|
reo marked this conversation as resolved
|
||||
|
||||
dbg_ui.text("Hello World!".to_owned());
|
||||
dbg_ui.text(format!("Frame Delta: {}", pctx.time_ctx.frame_dt));
|
||||
dbg_ui.text(format!("Fixed Delta: {}", pctx.time_ctx.fixed_dt));
|
||||
|
|
@ -75,6 +76,7 @@ impl System for RenderingTestSystem {
|
|||
|
||||
fn fixed_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let pctx = res.get::<PlatformContext>().unwrap();
|
||||
|
||||
scene.world.query_mut::<(&mut Transform, &ModelHandle)>().into_iter().for_each(|(_, (t, _))| {
|
||||
t.rotation *= Quat::from_rotation_y(*self.rotation_speed.borrow() * pctx.time_ctx.fixed_dt);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue
Looking at this mess makes me want to invent a simple domain-specific language to specify which resources a system needs, and then make a macro to generate this code.
I've never made a list of the most over-engineered things I've created. If I were to start now I wouldn't have trouble deciding which one gets the top spot.
Solved by implementing
get_many