Option to disable the UI
This commit is contained in:
parent
4db3fb6279
commit
3fafaff04f
|
@ -78,6 +78,7 @@ mod ui;
|
||||||
pub struct DemoApp<W> where W: Window {
|
pub struct DemoApp<W> where W: Window {
|
||||||
pub window: W,
|
pub window: W,
|
||||||
pub should_exit: bool,
|
pub should_exit: bool,
|
||||||
|
pub options: Options,
|
||||||
|
|
||||||
window_size: WindowSize,
|
window_size: WindowSize,
|
||||||
|
|
||||||
|
@ -147,13 +148,14 @@ impl<W> DemoApp<W> where W: Window {
|
||||||
let ground_line_vertex_array = GroundLineVertexArray::new(&renderer.device,
|
let ground_line_vertex_array = GroundLineVertexArray::new(&renderer.device,
|
||||||
&ground_program);
|
&ground_program);
|
||||||
|
|
||||||
let mut ui = DemoUI::new(&renderer.device, resources, options);
|
let mut ui = DemoUI::new(&renderer.device, resources, options.clone());
|
||||||
let mut message_epoch = 0;
|
let mut message_epoch = 0;
|
||||||
emit_message::<W>(&mut ui, &mut message_epoch, expire_message_event_id, message);
|
emit_message::<W>(&mut ui, &mut message_epoch, expire_message_event_id, message);
|
||||||
|
|
||||||
DemoApp {
|
DemoApp {
|
||||||
window,
|
window,
|
||||||
should_exit: false,
|
should_exit: false,
|
||||||
|
options,
|
||||||
|
|
||||||
window_size,
|
window_size,
|
||||||
|
|
||||||
|
@ -405,6 +407,7 @@ impl<W> DemoApp<W> where W: Window {
|
||||||
self.take_screenshot();
|
self.take_screenshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.options.ui {
|
||||||
if let Some(render_stats) = frame.render_stats.take() {
|
if let Some(render_stats) = frame.render_stats.take() {
|
||||||
self.renderer.debug_ui.add_sample(render_stats.stats,
|
self.renderer.debug_ui.add_sample(render_stats.stats,
|
||||||
frame.render_msg.tile_time,
|
frame.render_msg.tile_time,
|
||||||
|
@ -429,6 +432,7 @@ impl<W> DemoApp<W> where W: Window {
|
||||||
|
|
||||||
frame.ui_events = self.renderer.debug_ui.ui.event_queue.drain();
|
frame.ui_events = self.renderer.debug_ui.ui.event_queue.drain();
|
||||||
self.handle_ui_action(&mut ui_action);
|
self.handle_ui_action(&mut ui_action);
|
||||||
|
}
|
||||||
|
|
||||||
// Switch camera mode (2D/3D) if requested.
|
// Switch camera mode (2D/3D) if requested.
|
||||||
//
|
//
|
||||||
|
@ -721,6 +725,7 @@ pub struct Options {
|
||||||
pub jobs: Option<usize>,
|
pub jobs: Option<usize>,
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
pub input_path: SVGPath,
|
pub input_path: SVGPath,
|
||||||
|
pub ui: bool,
|
||||||
hidden_field_for_future_proofing: (),
|
hidden_field_for_future_proofing: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,6 +735,7 @@ impl Default for Options {
|
||||||
jobs: None,
|
jobs: None,
|
||||||
mode: Mode::TwoD,
|
mode: Mode::TwoD,
|
||||||
input_path: SVGPath::Default,
|
input_path: SVGPath::Default,
|
||||||
|
ui: true,
|
||||||
hidden_field_for_future_proofing: (),
|
hidden_field_for_future_proofing: (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -748,6 +754,8 @@ impl Options {
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name("3d").short("3").long("3d").help("Run in 3D").conflicts_with("vr"))
|
.arg(Arg::with_name("3d").short("3").long("3d").help("Run in 3D").conflicts_with("vr"))
|
||||||
.arg(Arg::with_name("vr").short("V").long("vr").help("Run in VR").conflicts_with("3d"))
|
.arg(Arg::with_name("vr").short("V").long("vr").help("Run in VR").conflicts_with("3d"))
|
||||||
|
.arg(Arg::with_name("ui").short("U").long("ui").help("Show UI").conflicts_with("no-ui"))
|
||||||
|
.arg(Arg::with_name("no-ui").short("u").long("no-ui").help("Hide UI").conflicts_with("ui"))
|
||||||
.arg(Arg::with_name("INPUT").help("Path to the SVG file to render").index(1))
|
.arg(Arg::with_name("INPUT").help("Path to the SVG file to render").index(1))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
@ -761,6 +769,12 @@ impl Options {
|
||||||
self.mode = Mode::VR;
|
self.mode = Mode::VR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matches.is_present("ui") {
|
||||||
|
self.ui = true;
|
||||||
|
} else if matches.is_present("no-ui") {
|
||||||
|
self.ui = false;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(path) = matches.value_of("INPUT") {
|
if let Some(path) = matches.value_of("INPUT") {
|
||||||
self.input_path = SVGPath::Path(PathBuf::from(path));
|
self.input_path = SVGPath::Path(PathBuf::from(path));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue