Skip to content

Commit

Permalink
move examples into their own project directories
Browse files Browse the repository at this point in the history
  • Loading branch information
coderedart committed Feb 26, 2024
1 parent 815d9e8 commit 511bac2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ egui_render_three_d = { version = "0.8", path = "crates/egui_render_three_d", op
# because opengl doesn't work on mac :((
egui_render_wgpu = { version = "0.8", path = "crates/egui_render_wgpu", optional = true }

[dev-dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
egui = { workspace = true }


[workspace.dependencies]
egui = { version = "0.26", default-features = false }
bytemuck = { version = "1", default-features = false }
tracing = { version = "0.1", default-features = false }
raw-window-handle = { version = "0.6" }
egui_overlay = { version = "0.8", path = "." }
egui_render_three_d = { version = "0.8", path = "crates/egui_render_three_d" }
egui_render_wgpu = { version = "0.8", path = "crates/egui_render_wgpu" }
egui_window_glfw_passthrough = { version = "0.8", path = "crates/egui_window_glfw_passthrough" }

[workspace]
members = [
"crates/egui_render_three_d",
"crates/egui_render_glow",
"crates/egui_render_wgpu",
"crates/egui_window_glfw_passthrough",
"examples/*",
]

[workspace.package]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ As you can see in `lib.rs`, its barely 150 lines of code to set up. It will allo
Look at the `basic` example for a rough idea of how to use this crate for normal usecase.
Look at the `triangle` example (only for linux/windows users, as i use three-d), to see how you can draw custom stuff too.

> use `cargo run -p basic` to run the example.

https://github.com/coderedart/egui_overlay/assets/24411704/9f7bab7b-26ec-47d1-b51e-74006dfa7b0d
Expand Down
20 changes: 20 additions & 0 deletions examples/basic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "basic"
version.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true
description = "A basic example that shows how we can use egui_overlay crate"
publish = false

[features]
three_d = ["dep:egui_render_three_d"]
wgpu = ["dep:egui_render_wgpu"]

[dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
egui = { workspace = true }
egui_overlay = { workspace = true }
egui_window_glfw_passthrough = { workspace = true }
egui_render_three_d = { workspace = true, optional = true }
egui_render_wgpu = { workspace = true, optional = true }
2 changes: 2 additions & 0 deletions examples/basic.rs → examples/basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use egui_render_three_d::ThreeDBackend as DefaultGfxBackend;
#[cfg(feature = "wgpu")]
use egui_render_wgpu::WgpuBackend as DefaultGfxBackend;

#[cfg(not(any(feature = "three_d", feature = "wgpu")))]
compile_error!("you must enable either `three_d` or `wgpu` feature to run this example");
fn main() {
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
// if RUST_LOG is not set, we will use the following filters
Expand Down
15 changes: 15 additions & 0 deletions examples/triangle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "triangle"
version.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true
description = "Shows how we can use egui_overlay crate to render egui and use three-d crate to render a triangle at the same time"
publish = false


[dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
egui = { workspace = true }
egui_render_three_d = { workspace = true }
egui_overlay = { workspace = true }
File renamed without changes.

0 comments on commit 511bac2

Please sign in to comment.