INNER CODE UNIT · Rust

draw

PistonDevelopers/piston_window · src/piston_script.rs:229

    pub fn draw(rt: &mut Runtime) -> Result<(), String> {
        let e = unsafe { &*Current::<Option<Event>>::new() };
        if let &Some(ref e) = e {
            if e.render_args().is_some() {
                let glyphs = unsafe { &mut *Current::<Vec<GlyphCache>>::new() };
                let textures = unsafe { &mut *Current::<Vec<Texture>>::new() };
                let window = unsafe { &mut *Current::<PistonWindow>::new() };

                if let Some(x) = window.draw_2d(e, |c, g, _| draw_2d(rt, glyphs, textures, c, g)) {x}
                else {Err("Drawing failed".to_string())}
            } else {
                Ok(())
            }
        } else {
            Err(NO_EVENT.into())
        }
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…