Skip to content

Commit 0d2d5e6

Browse files
committed
#318 - This solves the Wayland crash on my system. More testing required.
1 parent 0a7fcbc commit 0d2d5e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bracket-terminal/src/hal/native/mainloop.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,13 @@ pub fn main_loop<GS: GameState>(mut bterm: BTerm, mut gamestate: GS) -> BResult<
201201
if time_since_last_frame < wait_time {
202202
// We're wrapping the spin sleeper in a feature now. If you want to use it,
203203
// enable "low_cpu". Otherwise, it was causing input lag.
204-
#[cfg(feature = "low_cpu")]
205204
let delay = u64::min(33, wait_time - time_since_last_frame);
206205
//println!("Frame time: {}ms, Delay: {}ms", time_since_last_frame, delay);
207-
//*control_flow = ControlFlow::WaitUntil(Instant::now() + std::time::Duration::from_millis(delay));
206+
#[cfg(not(feature = "low_cpu"))]
207+
{
208+
std::thread::sleep(std::time::Duration::from_millis(delay));
209+
//*control_flow = ControlFlow::WaitUntil(Instant::now() + std::time::Duration::from_micros(delay));
210+
}
208211
#[cfg(feature = "low_cpu")]
209212
spin_sleeper.sleep(std::time::Duration::from_millis(delay));
210213
} else {

0 commit comments

Comments
 (0)