Skip to content

Window closed() event function is never called #1088

Description

@sidwellr

When creating a window, one of the event functions is closed(). But it never seems to be called. Here is a program that demonstrates this:

use nannou::prelude::*;

fn main() {
    nannou::app(model).update(update).view(view).run();
}

struct Model {}

fn model(app: &App) -> Model {
    let _win = app.new_window()
        .size(720, 720)
        .closed(window_closed)
        .build();
    Model {}
}

fn update(_app: &App, _model: &mut Model) {}

fn view(app: &App, _model: &Model, _entity: Entity) {
    let draw = app.draw();
    draw.background().color(STEEL_BLUE);
}

fn window_closed(_app: &App, _model: &mut Model) {
    println!("The window is closed.");
}

Run it, then close the window. The message "The window is closed." should be printed on the console, but isn't. A similar program for nannou 0.19.0 works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions