From 20697c37b0d384b05da53b24114b4637777c3bf6 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 21 Feb 2023 15:23:18 +0900 Subject: [PATCH] Minor fix, set fps on native builds --- src/agnostic_interface/raylib_impl.rs | 11 +++++++++++ src/original_impl.rs | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/agnostic_interface/raylib_impl.rs b/src/agnostic_interface/raylib_impl.rs index 0054ff4..67a24a9 100644 --- a/src/agnostic_interface/raylib_impl.rs +++ b/src/agnostic_interface/raylib_impl.rs @@ -555,6 +555,16 @@ struct RaylibGame { } impl RaylibGame { + #[cfg(not(target_arch = "wasm32"))] + fn native_setup() { + unsafe { + ffi::SetTargetFPS(60); + } + } + + #[cfg(target_arch = "wasm32")] + fn native_setup() {} + pub fn new_boxed(width: u32, height: u32) -> Box { unsafe { let string = "One and All LD45\0"; @@ -564,6 +574,7 @@ impl RaylibGame { string.as_ptr() as *const c_char, ); } + Self::native_setup(); let mut self_unboxed = Self { images: HashMap::new(), fonts: HashMap::new(), diff --git a/src/original_impl.rs b/src/original_impl.rs index d085952..28c1ca4 100644 --- a/src/original_impl.rs +++ b/src/original_impl.rs @@ -1306,12 +1306,7 @@ impl GameState { )?; let mut camera = window.get_gi_mut().get_default_camera()?; - camera.set_view(Rectangle { - x: 0.0, - y: 0.0, - w: WIDTH_F, - h: HEIGHT_F, - })?; + camera.set_view_xy(0.0, 0.0)?; Ok(Self { s_boom, s_get,