Skip to content

Commit

Permalink
Create native desktop app
Browse files Browse the repository at this point in the history
  • Loading branch information
eshikafe committed Oct 16, 2024
1 parent 6f20fa6 commit bf23f29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion synfig-core/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::vector::Vector;
// revision release.
//

pub const SYNFIG_VERSION: &str = "01.04.00";
pub const SYNFIG_VERSION: &str = env!("CARGO_PKG_VERSION");

// Increment this value whenever
// the library changes in a way
Expand Down
1 change: 1 addition & 0 deletions synfig-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ keywords = ["animation", "vector-graphics", "2d"]

[dependencies]
synfig-core = {path = "../synfig-core"}
eframe = "0.29.1"
30 changes: 28 additions & 2 deletions synfig-gui/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
use synfig_core::version::*;
use eframe::egui;

fn main() {
println!("Welcome to Synfig-rs v{}", get_version());
let native_options = eframe::NativeOptions::default();
let _ = eframe::run_native(
"Synfig-rs Studio",
native_options,
Box::new(|cc| Ok(Box::new(SynfigStudio::new(cc)))),
);
}

#[derive(Default)]
struct SynfigStudio {}

impl SynfigStudio {
fn new(cc: &eframe::CreationContext<'_>) -> Self {
// Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
// Restore app state using cc.storage (requires the "persistence" feature).
// Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
// for e.g. egui::PaintCallback.
Self::default()
}
}

impl eframe::App for SynfigStudio {
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Toolbox");
});
}
}

0 comments on commit bf23f29

Please sign in to comment.