diff options
author | tom barrett <spalf0@gmail.com> | 2019-07-24 05:54:49 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-07-24 05:54:49 -0500 |
commit | 7d2c0954cd95bdabcb7ecf26f9225382ab078289 (patch) | |
tree | c6b140c1e73ff27f8ab340f68024210215dcb708 /src/world.rs | |
parent | c25884efd8d1a239c88dbafd7a0e12eca3c7401b (diff) |
dialog box
Diffstat (limited to 'src/world.rs')
-rw-r--r-- | src/world.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/world.rs b/src/world.rs index f89e9e7..abbb9c1 100644 --- a/src/world.rs +++ b/src/world.rs @@ -3,6 +3,7 @@ use ggez::graphics::{self, spritebatch::SpriteBatch, DrawParam, FilterMode, Imag use ggez::{filesystem, Context, GameResult}; use crate::camera::Camera; +use crate::dialogbox::DialogBox; use crate::entity::Operable; use crate::map::Map; use crate::npc::NPC; @@ -12,6 +13,7 @@ use crate::tileset::Tileset; pub struct World { map: Map, spritebatch: SpriteBatch, + dialogbox: DialogBox, camera: Camera, player: Player, npcs: Vec<NPC>, @@ -30,6 +32,7 @@ impl World { Ok(World { map: map.clone(), spritebatch: SpriteBatch::new(image), + dialogbox: DialogBox::new(context), camera: Camera::new(map.get_dimensions()), player: Player::new( &tileset, @@ -68,6 +71,8 @@ impl EventHandler for World { DrawParam::default().dest(self.camera.draw), )?; + self.dialogbox.draw(context)?; + self.spritebatch.clear(); graphics::present(context)?; @@ -89,6 +94,7 @@ impl EventHandler for World { if !repeat { match keycode { KeyCode::Q => context.continuing = false, + KeyCode::E => self.dialogbox.visible = !self.dialogbox.visible, _ => self.player.give_key_down(keycode), } } |