-use ggez::graphics::{self, DrawParam, Image, Rect};
+use ggez::graphics::{self, DrawMode, DrawParam, Image, Mesh, Rect};
use ggez::{Context, GameResult};
const DEFAULT_RADIUS: f32 = 70f32;
pub fn draw(&self, ctx: &mut Context, door_image: &Image) -> GameResult<()> {
if self.is_open {
+ let bg_mesh = Mesh::new_rectangle(
+ ctx,
+ DrawMode::fill(),
+ Rect::new(0f32, 0f32, 96f32, 160f32),
+ graphics::BLACK,
+ )?;
+ graphics::draw(ctx, &bg_mesh, DrawParam::new().dest([self.x, self.y]))?;
graphics::draw(
ctx,
door_image,
puzzle_states: HashMap<PuzzleID, bool>,
puzzle: Option<Puzzle>,
success_sfx: Source,
+ bg_image: Image,
}
impl MainScene {
puzzle_states: HashMap::new(),
puzzle: None,
success_sfx: Source::new(ctx, "/success.ogg").unwrap(),
+ bg_image: Image::new(ctx, "/bg.png").unwrap(),
}
}
fn draw(&mut self, ctx: &mut Context) -> GameResult<()> {
{
+ graphics::draw(ctx, &self.bg_image, DrawParam::new())?;
let ground_mesh = Mesh::new_rectangle(
ctx,
DrawMode::fill(),