mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-07 07:15:45 -06:00
fix(emscripten): string pointer casting, fixup AssetError handling
This commit is contained in:
@@ -40,7 +40,7 @@ impl Platform for EmscriptenPlatform {
|
|||||||
let mut buf = vec![0u8; len];
|
let mut buf = vec![0u8; len];
|
||||||
rwops
|
rwops
|
||||||
.read_exact(&mut buf)
|
.read_exact(&mut buf)
|
||||||
.map_err(|e| AssetError::Io(std::io::Error::new(std::io::ErrorKind::Other, e)))?;
|
.map_err(|e| AssetError::Io(std::io::Error::other(e)))?;
|
||||||
|
|
||||||
Ok(Cow::Owned(buf))
|
Ok(Cow::Owned(buf))
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,6 @@ extern "C" {
|
|||||||
unsafe fn get_canvas_size() -> (u32, u32) {
|
unsafe fn get_canvas_size() -> (u32, u32) {
|
||||||
let mut width = 0.0;
|
let mut width = 0.0;
|
||||||
let mut height = 0.0;
|
let mut height = 0.0;
|
||||||
emscripten_get_element_css_size("canvas\0".as_ptr(), &mut width, &mut height);
|
emscripten_get_element_css_size(c"canvas".as_ptr().cast(), &mut width, &mut height);
|
||||||
(width as u32, height as u32)
|
(width as u32, height as u32)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ impl DirectionalAnimatedTexture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(&mut self, dt: f32) {
|
pub fn tick(&mut self, dt: f32) {
|
||||||
for texture in self.textures.iter_mut() {
|
for texture in self.textures.iter_mut().flatten() {
|
||||||
if let Some(texture) = texture {
|
texture.tick(dt);
|
||||||
texture.tick(dt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user