slint/tools/viewer/main.rs
Simon Hausmann 9df888578f Expose a ComponentWindow type in Rust
This comes with a factory function that re-directs to the backend and a
run member function to replace
sixtyfps_runtime_run_component_with_gl_renderer. For now it's all still
hidden in the generated run() method.
2020-06-17 19:15:18 +02:00

24 lines
635 B
Rust

use structopt::StructOpt;
#[derive(StructOpt)]
struct Cli {
#[structopt(name = "path to .60 file", parse(from_os_str))]
path: std::path::PathBuf,
}
fn main() -> std::io::Result<()> {
let args = Cli::from_args();
let source = std::fs::read_to_string(&args.path)?;
let c = match sixtyfps_interpreter::load(source.as_str(), &args.path) {
Ok(c) => c,
Err(diag) => {
diag.print(source);
std::process::exit(-1);
}
};
let window = sixtyfps_rendering_backend_gl::create_gl_window();
let component = c.create();
window.run(component.borrow());
Ok(())
}