From 7d2c0954cd95bdabcb7ecf26f9225382ab078289 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Wed, 24 Jul 2019 05:54:49 -0500 Subject: dialog box --- src/world.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/world.rs') 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, @@ -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), } } -- cgit v1.2.3