Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every time a keyboard event is received, a render event is emitted when updates are disabled #155

Open
friedrich opened this issue Jan 23, 2018 · 0 comments

Comments

@friedrich
Copy link

When updates are disabled with ups(0) and the window receives a keyboard event, render events are emitted. Here is an example that should render only once a second but instead renders also on every keyboard event:

extern crate piston;
extern crate opengl_graphics;
extern crate graphics;
extern crate glfw_window;

use opengl_graphics::OpenGL;
use piston::window::WindowSettings;
use piston::input::*;
use piston::event_loop::*;
use glfw_window::GlfwWindow as AppWindow;

fn main() {
    let opengl = OpenGL::V3_2;
    let mut window: AppWindow = WindowSettings::new("Test", [100, 100])
        .exit_on_esc(true)
        .opengl(opengl)
        .build()
        .unwrap();

    let mut events = Events::new(EventSettings::new().max_fps(1).ups(0));
    while let Some(e) = events.next(&mut window) {
        if let Some(_) = e.render_args() {
            println!("Render");
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant