INNER CODE UNIT · Rust

texture_context

PistonDevelopers/piston_window · src/piston_script.rs:219

        let texture_context = unsafe { &*Current::<TextureContext>::new() };
        let texture_settings = TextureSettings::new().filter(Filter::Nearest);
        Ok(match GlyphCache::<'static, TextureContext, Texture>::new(
            &**file, texture_context.clone(), texture_settings
        ) {
            Ok(x) => Ok::<RustObject, Arc<String>>(to_rust_object(x)).push_var(),
            Err(err) => Err::<RustObject, Arc<String>>(Arc::new(format!("{}", err))).push_var(),
        })
    }

    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() };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…