1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::{EguiAction, EguiActions};
use egui::{Context, Vec2, Window};

pub fn draw_experimental_shaders_window(
    ctx: &Context,
    open: &mut bool,
    egui_actions: &mut EguiActions,
    experimental_shaders: &[(String, bool)],
) {
    Window::new("Experimental Shaders")
        .open(open)
        .default_width(250.0)
        .default_height(600.0)
        .show(ctx, |ui| {
            ui.spacing_mut().item_spacing = Vec2::new(10.0, 10.0);
            experimental_shaders.iter().for_each(|(shader, enabled)| {
                let mut enabled_mut = *enabled;

                ui.checkbox(&mut enabled_mut, shader);

                if enabled_mut != *enabled {
                    egui_actions.actions.push(EguiAction::SetExperimentalShader(
                        shader.into(),
                        enabled_mut,
                    ));
                }
            })
        });
}