Skip to content

Commit

Permalink
Moved examples to top level
Browse files Browse the repository at this point in the history
demo is also now the bevy example
  • Loading branch information
urholaukkarinen committed Apr 5, 2024
1 parent 9b9b450 commit 1c93811
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 130 deletions.
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/*"]
members = ["crates/*", "examples/*"]

[workspace.package]
version = "0.1.0"
Expand All @@ -12,10 +12,9 @@ repository = "https://github.com/urholaukkarinen/transform-gizmo"
authors = ["Urho Laukkarinen <[email protected]>"]

[workspace.dependencies]
transform-gizmo = { path = "crates/transform-gizmo", default-features = false }
transform-gizmo-egui = { path = "crates/transform-gizmo-egui", default-features = false }
transform-gizmo-bevy = { path = "crates/transform-gizmo-bevy", default-features = false }
transform-gizmo-demo = { path = "crates/transform-gizmo-demo", default-features = false }
transform-gizmo = { path = "crates/transform-gizmo" }
transform-gizmo-egui = { path = "crates/transform-gizmo-egui" }
transform-gizmo-bevy = { path = "crates/transform-gizmo-bevy" }

egui = "0.27.2"
eframe = "0.27.2"
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ information about user interaction, in the form of `GizmoInteraction`.
For rendering the gizmo, `Gizmo::draw` provides vertices in viewport coordinates that can be easily rendered
with your favorite graphics APIs.

## Demo

For a more complete example, see the online demo at <https://urholaukkarinen.github.io/transform-gizmo/>.

The demo sources can be found at <https://github.com/urholaukkarinen/transform-gizmo/blob/main/crates/transform-gizmo-demo/src/main.rs>.

## Other

The gizmo exposes matrices and vectors as [mint](https://github.com/kvark/mint) types, which means it is easy to use with matrix types from various crates
Expand Down
97 changes: 0 additions & 97 deletions crates/transform-gizmo-bevy/examples/bevy.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/transform-gizmo-demo/.gitignore

This file was deleted.

Binary file removed crates/transform-gizmo-demo/crate.png
Binary file not shown.
2 changes: 1 addition & 1 deletion crates/transform-gizmo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! with your favorite graphics APIs.
//!
//! For a more complete example, see the online demo at <https://urholaukkarinen.github.io/transform-gizmo/>.
//! The demo sources can be found at <https://github.com/urholaukkarinen/transform-gizmo/blob/main/crates/transform-gizmo-demo/src/main.rs>.
//! The demo sources can be found at <https://github.com/urholaukkarinen/transform-gizmo/blob/main/examples/bevy/src/main.rs>.
//! ```
mod shape;
Expand Down
1 change: 1 addition & 0 deletions docs/bevy-example.js

Large diffs are not rendered by default.

Binary file added docs/bevy-example_bg.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<title>transform-gizmo demo</title><style>html{touch-action:manipulation}body,canvas,html{margin:0!important;padding:0!important;height:100%!important;width:100%!important;overflow:hidden;background:black;z-index:0}canvas{outline:none;display:block;position:absolute;top:0%;left:50%;transform:translate(-50%,0%)}</style><script type=module>import a,*as b from"/bevy-example.js";a(`/bevy-example_bg.wasm`);window.wasmBindings=b</script><base href=/><link as=fetch crossorigin href=/bevy-example_bg.wasm integrity=sha384-6Z-SFN6kAgL5W3NCtJ7RqA9nD8_l2w1hxCKpL31AvyOqE4EMrTdglfKmKt-KNNO2 rel=preload type=application/wasm><link crossorigin href=/bevy-example.js integrity=sha384-8IAkFedG4DooakeSIaa7WF3mzHDL32PU-TojrUtEWAND2K62-AwdQhSAZBbCAImk rel=modulepreload></head><body oncontextmenu="return false;"></body></html>
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[package]
name = "transform-gizmo-demo"
description = "demo app for transform-gizmo"

name = "bevy-example"
version.workspace = true
authors.workspace = true
rust-version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
authors.workspace = true
publish = false

[dependencies]
transform-gizmo-bevy.workspace = true
transform-gizmo-egui.workspace = true

bevy.workspace = true
bevy_infinite_grid = { git = "https://github.com/XYCaptain/bevy_infinite_grid.git", rev = "1e5259a52a7dfaca65402c2c57c1d81c2bc443e9" }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
</style>

<link data-trunk rel="rust" href="Cargo.toml" data-wasm-opt="z" data-bin="transform-gizmo-demo" />
<link data-trunk rel="rust" href="Cargo.toml" data-wasm-opt="z" data-bin="bevy-example" />

<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
<base data-trunk-public-url />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use bevy::input::mouse::{MouseMotion, MouseWheel};
use bevy::math::vec2;
use bevy::prelude::*;

/// https://bevy-cheatbook.github.io/cookbook/pan-orbit-camera.html
pub struct PanOrbitCameraPlugin;
impl Plugin for PanOrbitCameraPlugin {
fn build(&self, app: &mut App) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn draw_options(ui: &mut egui::Ui, gizmo_options: &mut GizmoOptions) {
ui.separator();

ui.with_layout(Layout::bottom_up(egui::Align::Center), |ui| {
egui::Hyperlink::from_label_and_url("(source code)", "https://github.com/urholaukkarinen/transform-gizmo/blob/main/crates/transform-gizmo-demo/src/main.rs").ui(ui);
egui::Hyperlink::from_label_and_url("(source code)", "https://github.com/urholaukkarinen/transform-gizmo/blob/main/examples/bevy/src/main.rs").ui(ui);

ui.label("Move and rotate the camera using the middle and right mouse buttons");
ui.label("Toggle gizmo snapping with left ctrl & shift");
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use bevy_mod_picking::{
};
use transform_gizmo_bevy::GizmoTarget;

/// Integrates picking with gizmo and highlighting.
pub struct PickingPlugin;

impl Plugin for PickingPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.add_plugins(DefaultPickingPlugins.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use transform_gizmo_bevy::GizmoCamera;
use crate::camera::PanOrbitCamera;

pub struct ScenePlugin;

impl Plugin for ScenePlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.add_systems(Startup, setup_scene);
Expand Down
17 changes: 17 additions & 0 deletions examples/egui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "egui-example"
version.workspace = true
rust-version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
authors.workspace = true
publish = false

[dependencies]
transform-gizmo-egui.workspace = true
eframe.workspace = true

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use eframe::{egui, NativeOptions};
use transform_gizmo::math::DQuat;
use transform_gizmo_egui::math::DQuat;
use transform_gizmo_egui::{
math::{DMat4, DVec3},
*,
Expand Down
12 changes: 0 additions & 12 deletions scripts/build_demo_web.sh

This file was deleted.

0 comments on commit 1c93811

Please sign in to comment.