forked from emilk/egui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine demo_glium and demo_web into one egui_demo crate
- Loading branch information
Showing
19 changed files
with
93 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/target | ||
/.*.json | ||
/.vscode | ||
/media/* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cargo run --bin egui_demo --release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Pre-requisites: | ||
rustup target add wasm32-unknown-unknown | ||
if ! wasm-bindgen --version; then | ||
cargo clean | ||
cargo install -f wasm-bindgen-cli | ||
cargo update | ||
fi | ||
|
||
# BUILD=debug | ||
BUILD=release | ||
CRATE_NAME="egui_demo" | ||
|
||
export RUSTFLAGS=--cfg=web_sys_unstable_apis # required for the clipboard API | ||
|
||
# Clear output from old stuff: | ||
rm -rf docs/demo_web.wasm | ||
rm -rf docs/$CRATE_NAME.wasm | ||
|
||
echo "Build rust:" | ||
# cargo build -p demo_web --target wasm32-unknown-unknown | ||
cargo build --release -p demo_web --target wasm32-unknown-unknown | ||
echo "Building rust…" | ||
BUILD=release | ||
cargo build --release -p $CRATE_NAME --lib --target wasm32-unknown-unknown | ||
|
||
echo "Generate JS bindings for wasm:" | ||
FOLDER_NAME=${PWD##*/} | ||
TARGET_NAME="demo_web.wasm" | ||
echo "Generating JS bindings for wasm…" | ||
TARGET_NAME="$CRATE_NAME.wasm" | ||
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ | ||
--out-dir docs --no-modules --no-typescript | ||
|
||
echo "Finished: docs/$CRATE_NAME.wasm" | ||
|
||
open http://localhost:8888/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Pre-requisites: | ||
rustup target add wasm32-unknown-unknown | ||
if ! wasm-bindgen --version; then | ||
cargo clean | ||
cargo install -f wasm-bindgen-cli | ||
cargo update | ||
fi | ||
|
||
# BUILD=debug | ||
BUILD=release | ||
CRATE_NAME="example_web" | ||
|
||
export RUSTFLAGS=--cfg=web_sys_unstable_apis # required for the clipboard API | ||
|
||
# Clear output from old stuff: | ||
rm -rf docs/example_web.wasm | ||
rm -rf docs/$CRATE_NAME.wasm | ||
|
||
echo "Build rust:" | ||
# cargo build -p example_web --target wasm32-unknown-unknown | ||
cargo build --release -p example_web --target wasm32-unknown-unknown | ||
echo "Building rust…" | ||
BUILD=release | ||
cargo build --release -p $CRATE_NAME --lib --target wasm32-unknown-unknown | ||
|
||
echo "Generate JS bindings for wasm:" | ||
FOLDER_NAME=${PWD##*/} | ||
TARGET_NAME="example_web.wasm" | ||
echo "Generating JS bindings for wasm…" | ||
TARGET_NAME="$CRATE_NAME.wasm" | ||
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ | ||
--out-dir docs --no-modules --no-typescript | ||
|
||
echo "Finished: docs/$CRATE_NAME.wasm" | ||
|
||
open http://localhost:8888/example.html |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "demo_web" | ||
name = "egui_demo" | ||
version = "0.1.0" | ||
authors = ["Emil Ernerfeldt <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -10,8 +10,14 @@ crate-type = ["cdylib", "rlib"] | |
|
||
[dependencies] | ||
egui = { path = "../egui", features = ["serde", "serde_json"] } | ||
serde = { version = "1", features = ["derive"] } | ||
|
||
# For compiling natively: | ||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
egui_glium = { path = "../egui_glium" } | ||
|
||
# For compiling to web: | ||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
egui_web = { path = "../egui_web" } | ||
js-sys = "0.3" | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
wasm-bindgen = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# egui_web fetch example | ||
|
||
This is an example of how to write a web-app which use the fetch API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Pre-requisites: | ||
rustup target add wasm32-unknown-unknown | ||
cargo install -f wasm-bindgen-cli | ||
cargo update |