Reduce framerate of orbclient example
This commit is contained in:
parent
079778cbf9
commit
d04147e1fc
1 changed files with 7 additions and 1 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use cosmic_text::{FontSystem, TextAction, TextBuffer, TextCursor, TextLineIndex, TextMetrics};
|
use cosmic_text::{FontSystem, TextAction, TextBuffer, TextCursor, TextLineIndex, TextMetrics};
|
||||||
use orbclient::{Color, EventOption, Renderer, Window, WindowFlag};
|
use orbclient::{Color, EventOption, Renderer, Window, WindowFlag};
|
||||||
use std::{env, fs, time::Instant};
|
use std::{env, fs, thread, time::{Duration, Instant}};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
@ -166,7 +166,9 @@ fn main() {
|
||||||
log::debug!("redraw: {:?}", duration);
|
log::debug!("redraw: {:?}", duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut found_event = false;
|
||||||
for event in window.events() {
|
for event in window.events() {
|
||||||
|
found_event = true;
|
||||||
match event.to_option() {
|
match event.to_option() {
|
||||||
EventOption::Key(event) => match event.scancode {
|
EventOption::Key(event) => match event.scancode {
|
||||||
orbclient::K_CTRL => ctrl_pressed = event.pressed,
|
orbclient::K_CTRL => ctrl_pressed = event.pressed,
|
||||||
|
|
@ -271,5 +273,9 @@ fn main() {
|
||||||
buffer.action(TextAction::Scroll { lines: 3 });
|
buffer.action(TextAction::Scroll { lines: 3 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! found_event {
|
||||||
|
thread::sleep(Duration::from_millis(5));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue