comparison examples/stdrenderer.rs @ 743:0fed350d1778

examples: Remove deprecated std::mem::uninitialized().
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 07 Jan 2020 12:34:11 +0100
parents 0a250ddfae79
children 5e5e7136ac92
comparison
equal deleted inserted replaced
742:0a250ddfae79 743:0fed350d1778
147 let Box2D { width, height } = quad.size_override; 147 let Box2D { width, height } = quad.size_override;
148 148
149 // Create the AnmRunner from the ANM and the sprite. 149 // Create the AnmRunner from the ANM and the sprite.
150 let sprite = Rc::new(RefCell::new(Sprite::with_size(width, height))); 150 let sprite = Rc::new(RefCell::new(Sprite::with_size(width, height)));
151 let _anm_runner = AnmRunner::new(anms.clone(), quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0); 151 let _anm_runner = AnmRunner::new(anms.clone(), quad.anm_script as u8, sprite.clone(), Rc::downgrade(&prng), 0);
152 let mut new_vertices: [Vertex; 6] = unsafe { std::mem::uninitialized() }; 152 let mut new_vertices: [Vertex; 6] = {
153 let data = std::mem::MaybeUninit::uninit();
154 unsafe { data.assume_init() }
155 };
153 fill_vertices(sprite.clone(), &mut new_vertices, x, y, z); 156 fill_vertices(sprite.clone(), &mut new_vertices, x, y, z);
154 new_vertices[4] = new_vertices[0]; 157 new_vertices[4] = new_vertices[0];
155 new_vertices[5] = new_vertices[2]; 158 new_vertices[5] = new_vertices[2];
156 vertices.extend(&new_vertices); 159 vertices.extend(&new_vertices);
157 } 160 }