]> git.seodisparate.com - LudumDare45_StartWithNothing/commitdiff
Minor fix, set fps on native builds
authorStephen Seo <seo.disparate@gmail.com>
Tue, 21 Feb 2023 06:23:18 +0000 (15:23 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 21 Feb 2023 06:23:18 +0000 (15:23 +0900)
src/agnostic_interface/raylib_impl.rs
src/original_impl.rs

index 0054ff4a82fa26c4232ba976dc53d588e9e7be5a..67a24a9faabbbb43a6475692765a84b531f62f09 100644 (file)
@@ -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<dyn GameInterface> {
         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(),
index d0859525b338ab4dee22c7fab9ec3f94960acc0d..28c1ca478ee268715ce7d553db0ce326bd724650 100644 (file)
@@ -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,