Skip to content

Commit

Permalink
Reorg examples to top-level
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Jan 10, 2024
1 parent 2c74f3e commit 6827496
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/.idea
/sg2d-wgpu/tests/output/
.DS_Store
/sg2d-wgpu/examples/wgpu-winit/pkg/
/sg2d-wgpu/examples/wgpu-winit/target/
/sg2d-wgpu/examples/scatter-panning/pkg/
/sg2d-wgpu/examples/scatter-panning/target/
examples/wgpu-winit/pkg/
examples/wgpu-winit/target/
examples/scatter-panning/pkg/
examples/scatter-panning/target/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ cargo run
## Build wasm
To build the example above to WASM + WebGL2, run the following:
```
cd sg2d-wgpu/examples/wgpu-winit
cd examples/wgpu-winit
wasm-pack build --target web
```

Then open `sg2d-wgpu/examples/wgpu-winit/index.html` in a web browser.
Then open `examples/wgpu-winit/index.html` in a web browser.

## Export PNG
The `PngCanvas` struct can be used to convert a scene graph to a PNG image headlessly. See the tests in
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ crate-type = ["cdylib", "rlib"]
[workspace]

[dependencies]
sg2d-vega = { path = "../../../sg2d-vega" }
sg2d-wgpu = { path = "../../../sg2d-wgpu" }
sg2d = { path = "../../../sg2d" }
sg2d-vega = { path = "../../sg2d-vega" }
sg2d-wgpu = { path = "../../sg2d-wgpu" }
sg2d = { path = "../../sg2d" }

cfg-if = "1"
winit = "0.28"
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions examples/scatter-panning/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod util;
pub use util::run;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use wgpu_winit::run;
use crate::util::run;

mod util;

fn main() {
pollster::block_on(run());
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ crate-type = ["cdylib", "rlib"]
[workspace]

[dependencies]
sg2d-vega = { path = "../../../sg2d-vega" }
sg2d-wgpu = { path = "../../../sg2d-wgpu" }
sg2d = { path = "../../../sg2d" }
sg2d-vega = { path = "../../sg2d-vega" }
sg2d-wgpu = { path = "../../sg2d-wgpu" }
sg2d = { path = "../../sg2d" }

cfg-if = "1"
winit = "0.28"
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions examples/wgpu-winit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod util;
pub use util::run;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use scatter_panning::run;
mod util;
use crate::util::run;


fn main() {
pollster::block_on(run());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ pub async fn run() {
}
// Load scene graph
let scene_spec: VegaSceneGraph = serde_json::from_str(include_str!(
"../../../../sg2d-vega-test-data/vega-scenegraphs/symbol/binned_scatter_cross_stroke.sg.json"
"../../../sg2d-vega-test-data/vega-scenegraphs/symbol/binned_scatter_cross_stroke.sg.json"
))
.unwrap();

// Load dims
let scene_dims: VegaSceneGraphDims = serde_json::from_str(include_str!(
"../../../../sg2d-vega-test-data/vega-scenegraphs/symbol/binned_scatter_cross_stroke.dims.json"
"../../../sg2d-vega-test-data/vega-scenegraphs/symbol/binned_scatter_cross_stroke.dims.json"
))
.unwrap();

Expand Down
10 changes: 0 additions & 10 deletions sg2d-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]

[[example]]
name = "wgpu-winit"
path = "examples/wgpu-winit/src/main.rs"
crate-type = ["cdylib", "rlib"]

[[example]]
name = "scatter-panning"
path = "examples/scatter-panning/src/main.rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
sg2d = { path = "../sg2d" }

Expand Down
26 changes: 0 additions & 26 deletions sg2d-wgpu/index.html

This file was deleted.

0 comments on commit 6827496

Please sign in to comment.