message: fixed eventloop example by updating it to actually work like the current implementation of ggez::event::run()
diff: @@ -12,21 +12,25 @@ use ggez::event;
  use ggez::event::winit_event::{Event, KeyboardInput, WindowEvent};
  use ggez::graphics::{self, Color, DrawMode};
  use ggez::GameResult;
  +use winit::event_loop::ControlFlow;
  pub fn main() -> GameResult {
  let cb = ggez::ContextBuilder::new("eventloop", "ggez");
  - let (ref mut ctx, mut events_loop) = cb.build()?;
  + let (mut ctx, events_loop) = cb.build()?;
  let mut position: f32 = 1.0;
  - // This is also used in the loop inside `::run()` - it can be flipped off with `event::quit()`
  - while ctx.continuing {
  - // Tell the timer stuff a frame has happened.
  - // Without this the FPS timer functions and such won't work.
  - ctx.timer_context.tick();
  // Handle events. Refer to `winit` docs for more information.
  - use winit::platform::run_return::EventLoopExtRunReturn;
  - events_loop.run_return(|event, _window_target, control_flow| {
  + events_loop.run(move |event, _window_target, control_flow| {
  + if !ctx.continuing {
  + *control_flow = ControlFlow::Exit;
  + return;
  + }
  +
  + *control_flow = ControlFlow::Poll;
  +
  + let ctx = &mut ctx;
  +
  // This tells `ggez` to update it's internal states, should the event require that.
  // These include cursor position, view updating on resize, etc.
  event::process_event(ctx, &event);
  @@ -48,10 +52,10 @@ pub fn main() -> GameResult {
  // `CloseRequested` and `KeyboardInput` events won't appear here.
  x => println!("Other window event fired: {:?}", x),
  },
  -
  - x => println!("Device event fired: {:?}", x),
  - }
  - });
  + Event::MainEventsCleared => {
  + // Tell the timer stuff a frame has happened.
  + // Without this the FPS timer functions and such won't work.
  + ctx.timer_context.tick();
  // Update
  position += 1.0;
  @@ -65,10 +69,14 @@ pub fn main() -> GameResult {
  100.0,
  2.0,
  Color::WHITE,
  - )?;
  - graphics::draw(ctx, &circle, (glam::Vec2::new(position, 380.0),))?;
  - graphics::present(ctx)?;
  + )
  + .unwrap();
  + graphics::draw(ctx, &circle, (glam::Vec2::new(position, 380.0),)).unwrap();
  + graphics::present(ctx).unwrap();
  ggez::timer::yield_now();
  }
  - Ok(())
  +
  + x => println!("Device event fired: {:?}", x),
  + }
  + });
  }
  