(
ctx: &Context,
show: &mut bool,
frame_history: &mut FrameHistory,
state: &mut GraphicsViewState,
appearance: &Appearance,
)
| 87 | } |
| 88 | |
| 89 | pub fn graphics_window( |
| 90 | ctx: &Context, |
| 91 | show: &mut bool, |
| 92 | frame_history: &mut FrameHistory, |
| 93 | state: &mut GraphicsViewState, |
| 94 | appearance: &Appearance, |
| 95 | ) { |
| 96 | Window::new("Graphics").open(show).show(ctx, |ui| { |
| 97 | ui.label("Graphics backend:"); |
| 98 | ui.label( |
| 99 | RichText::new(&state.active_backend) |
| 100 | .color(appearance.emphasized_text_color) |
| 101 | .text_style(TextStyle::Monospace), |
| 102 | ); |
| 103 | ui.label("Graphics device:"); |
| 104 | ui.label( |
| 105 | RichText::new(&state.active_device) |
| 106 | .color(appearance.emphasized_text_color) |
| 107 | .text_style(TextStyle::Monospace), |
| 108 | ); |
| 109 | ui.label(format!("FPS: {:.1}", frame_history.fps())); |
| 110 | |
| 111 | ui.separator(); |
| 112 | let mut job = LayoutJob::default(); |
| 113 | job.append( |
| 114 | "WARNING: ", |
| 115 | 0.0, |
| 116 | TextFormat::simple(appearance.ui_font.clone(), appearance.delete_color), |
| 117 | ); |
| 118 | job.append( |
| 119 | "Changing the graphics backend may cause the application\nto no longer start or display correctly. Use with caution!", |
| 120 | 0.0, |
| 121 | TextFormat::simple(appearance.ui_font.clone(), appearance.emphasized_text_color), |
| 122 | ); |
| 123 | if let Some(config_path) = &state.graphics_config_path { |
| 124 | job.append( |
| 125 | "\n\nDelete the following file to reset:\n", |
| 126 | 0.0, |
| 127 | TextFormat::simple(appearance.ui_font.clone(), appearance.emphasized_text_color), |
| 128 | ); |
| 129 | job.append( |
| 130 | config_path.to_string_lossy().as_ref(), |
| 131 | 0.0, |
| 132 | TextFormat::simple( |
| 133 | FontId { |
| 134 | family: appearance.code_font.family.clone(), |
| 135 | size: appearance.ui_font.size, |
| 136 | }, |
| 137 | appearance.emphasized_text_color, |
| 138 | ), |
| 139 | ); |
| 140 | } |
| 141 | job.append( |
| 142 | "\n\nChanging the graphics backend will restart the application.", |
| 143 | 0.0, |
| 144 | TextFormat::simple(appearance.ui_font.clone(), appearance.replace_color), |
| 145 | ); |
| 146 | ui.label(job); |
no test coverage detected