Library & multiple binaries
Been playing with EGUI, and I'm gonna patch in a GUI app. The CLI version will need to kick around, too, but be separate from the GUI one. Enter: A multi-target crate!
This commit is contained in:
@@ -5,6 +5,15 @@ edition = "2021"
|
|||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rustpt_cli"
|
||||||
|
path = "src/cli_tool.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rustpt_gui"
|
||||||
|
path = "src/gui_tool.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rand = { version = "0.8.5", features = ["small_rng"] }
|
rand = { version = "0.8.5", features = ["small_rng"] }
|
||||||
itertools = { version = "0.11.0" }
|
itertools = { version = "0.11.0" }
|
||||||
|
eframe = "0.25.0"
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
|
|
||||||
mod primitives;
|
use rustpt::primitives::{
|
||||||
mod scene;
|
|
||||||
mod renderer;
|
|
||||||
|
|
||||||
use crate::primitives::{
|
|
||||||
Vec2i,
|
Vec2i,
|
||||||
Vec3,
|
Vec3,
|
||||||
};
|
};
|
||||||
use crate::scene::{
|
use rustpt::scene::{
|
||||||
Camera,
|
Camera,
|
||||||
Scene
|
Scene
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::renderer::{
|
use rustpt::renderer::{
|
||||||
Tile,
|
Tile,
|
||||||
RenderProperties,
|
RenderProperties,
|
||||||
};
|
};
|
||||||
36
src/gui_tool.rs
Normal file
36
src/gui_tool.rs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#![warn(clippy::all, rust_2018_idioms)]
|
||||||
|
use eframe::{egui, Frame};
|
||||||
|
|
||||||
|
fn main() -> Result<(), eframe::Error> {
|
||||||
|
let options = eframe::NativeOptions {
|
||||||
|
viewport: egui::ViewportBuilder::default()
|
||||||
|
.with_inner_size([800.0, 600.0])
|
||||||
|
.with_min_inner_size([50.0, 50.0])
|
||||||
|
.with_title("RustPT GUI Tool"),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
eframe::run_native(
|
||||||
|
"app name?",
|
||||||
|
options,
|
||||||
|
Box::new(
|
||||||
|
| cc | Box::new(RtApp::new(cc))
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct RtApp;
|
||||||
|
|
||||||
|
impl RtApp {
|
||||||
|
fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl eframe::App for RtApp {
|
||||||
|
fn update(&mut self, ctx: &egui::Context, frame: &mut Frame) {
|
||||||
|
egui::SidePanel::left("Render Properties").show(ctx, |ui| {
|
||||||
|
ui.heading("Render Properties");
|
||||||
|
ui.label("")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/lib.rs
Normal file
4
src/lib.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#![warn(clippy::all, rust_2018_idioms, rust_2018_compatibility)]
|
||||||
|
pub mod primitives;
|
||||||
|
pub mod scene;
|
||||||
|
pub mod renderer;
|
||||||
Reference in New Issue
Block a user