Skip to content

Commit

Permalink
Use ControlFlow:Poll in event loop
Browse files Browse the repository at this point in the history
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 imgui-rs#542
  • Loading branch information
dbr authored and sanbox-irl committed Oct 3, 2021
1 parent cfb9a67 commit 6eb5652
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion imgui-glow-renderer/examples/01_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion imgui-glow-renderer/examples/02_triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion imgui-glow-renderer/examples/03_triangle_gles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion imgui-glow-renderer/examples/04_custom_textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6eb5652

Please sign in to comment.