diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-17 18:39:19 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-17 18:39:19 +0100 |
commit | 5e8139c883fd5ac08608bddd1b3efd0a6f26409a (patch) | |
tree | a13fca9d6d6fd17a96d06e75c9ef284ce4b9b339 /src/main.rs | |
parent | Implement rendering (drawing) of tiles (diff) | |
download | Subconscious-rs-5e8139c883fd5ac08608bddd1b3efd0a6f26409a.tar.gz Subconscious-rs-5e8139c883fd5ac08608bddd1b3efd0a6f26409a.zip |
Encapsulate graphics functions to share a state with loaded resources
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index b5190bf..7b2809c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,17 +32,17 @@ fn main() { let game_state = game_state_mutex.clone(); let graphics_thread = thread::spawn(move || { - let mut window = graphics::start(); + let mut graphics = graphics::Graphics::new(); - while window.is_open() { + while graphics.is_running() { // aquire state resource let game_state = match game_state.lock() { Ok(game_state) => game_state, Err(poisoned) => poisoned.into_inner(), }; - graphics::render(&mut window, &game_state); - graphics::update(&mut window); + graphics.render(&game_state); + graphics.update(); } { |