Merge pull request #1 from DanielMowitz/DanielMowitz-patch-1
Daniel mowitz patch 1
This commit is contained in:
commit
9376fe9998
2 changed files with 19 additions and 10 deletions
|
@ -43,7 +43,7 @@ impl<'a> Dispatcher<'a> {
|
|||
max_stack_time,
|
||||
current_stack_start_time: Instant::now(),
|
||||
dt: 0.0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Works through the two stacks and dispatches the topmost
|
||||
|
@ -222,18 +222,23 @@ impl<'a> Dispatcher<'a> {
|
|||
match self.store_refs.take() {
|
||||
Some(x) => {
|
||||
local_store_refs = x;
|
||||
for reference in references {
|
||||
local_store_refs.push(Some(reference));
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
local_store_refs = vec![];
|
||||
}
|
||||
}
|
||||
|
||||
for reference in references {
|
||||
local_store_refs.push(Some(reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.store_refs = Some(local_store_refs);
|
||||
}
|
||||
|
||||
///Used to drop all Store references before ending the game loop
|
||||
pub fn drop_refs(&mut self) {
|
||||
match self.store_refs.take(){
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,12 @@ pub mod scene_manager;
|
|||
mod tests;
|
||||
|
||||
/// "Front-end"-function of the dispatcher
|
||||
pub fn game_loop<'a>(disp: &'a mut dispatcher::Dispatcher<'a>, store_refs: Vec<&'a mut store::Store<'a>>) {
|
||||
pub fn game_loop<'a>(mut disp: & mut dispatcher::Dispatcher<'a>, store_refs: Vec<&'a mut store::Store<'a>>) {
|
||||
|
||||
disp.enter_refs(store_refs);
|
||||
|
||||
while disp.dispatch() {};
|
||||
|
||||
disp.drop_refs();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue