Minor fix, set fps on native builds

This commit is contained in:
Stephen Seo 2023-02-21 15:23:18 +09:00
parent 31465d0923
commit 20697c37b0
2 changed files with 12 additions and 6 deletions

View 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(),

View 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,