Skip to content

Commit

Permalink
#318 - This solves the Wayland crash on my system. More testing requi…
Browse files Browse the repository at this point in the history
…red.
  • Loading branch information
thebracket committed Jan 10, 2023
1 parent 0a7fcbc commit 0d2d5e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bracket-terminal/src/hal/native/mainloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,13 @@ pub fn main_loop<GS: GameState>(mut bterm: BTerm, mut gamestate: GS) -> BResult<
if time_since_last_frame < wait_time {
// We're wrapping the spin sleeper in a feature now. If you want to use it,
// enable "low_cpu". Otherwise, it was causing input lag.
#[cfg(feature = "low_cpu")]
let delay = u64::min(33, wait_time - time_since_last_frame);
//println!("Frame time: {}ms, Delay: {}ms", time_since_last_frame, delay);
//*control_flow = ControlFlow::WaitUntil(Instant::now() + std::time::Duration::from_millis(delay));
#[cfg(not(feature = "low_cpu"))]
{
std::thread::sleep(std::time::Duration::from_millis(delay));
//*control_flow = ControlFlow::WaitUntil(Instant::now() + std::time::Duration::from_micros(delay));
}
#[cfg(feature = "low_cpu")]
spin_sleeper.sleep(std::time::Duration::from_millis(delay));
} else {
Expand Down

1 comment on commit 0d2d5e6

@Mooninghnk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so seems like it still crashes im on arch with wayland.

Please sign in to comment.