mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
Use ControlFlow:Poll in event loop
ControlFlow::Wait is more efficient but doesn't appear to currently work well on all platforms. Removed entirely from the earlier examples to keep them as simple as possible, but noted `ControlFlow::Wait` in the last example Closes #542
This commit is contained in:
parent
cfb9a671ec
commit
6eb56529da
@ -29,7 +29,6 @@ fn main() {
|
||||
|
||||
// Standard winit event loop
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = glutin::event_loop::ControlFlow::Wait;
|
||||
match event {
|
||||
glutin::event::Event::NewEvents(_) => {
|
||||
let now = Instant::now();
|
||||
|
||||
@ -17,7 +17,6 @@ fn main() {
|
||||
|
||||
let mut last_frame = Instant::now();
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = glutin::event_loop::ControlFlow::Wait;
|
||||
match event {
|
||||
glutin::event::Event::NewEvents(_) => {
|
||||
let now = Instant::now();
|
||||
|
||||
@ -32,7 +32,6 @@ fn main() {
|
||||
|
||||
let mut last_frame = Instant::now();
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = glutin::event_loop::ControlFlow::Wait;
|
||||
match event {
|
||||
glutin::event::Event::NewEvents(_) => {
|
||||
let now = Instant::now();
|
||||
|
||||
@ -36,7 +36,11 @@ fn main() {
|
||||
|
||||
let mut last_frame = Instant::now();
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
*control_flow = glutin::event_loop::ControlFlow::Wait;
|
||||
// Note we can potentially make the loop more efficient by
|
||||
// changing the `Poll` (default) value to `ControlFlow::Poll`
|
||||
// but be careful to test on all target platforms!
|
||||
*control_flow = glutin::event_loop::ControlFlow::Poll;
|
||||
|
||||
match event {
|
||||
glutin::event::Event::NewEvents(_) => {
|
||||
let now = Instant::now();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user