Update to egui 0.7.0 with switch to eframe as the only dependency

This commit is contained in:
Emil Ernerfeldt 2021-01-04 16:10:12 +01:00
parent e0cfa81c85
commit 0492545a7a
11 changed files with 368 additions and 247 deletions

View file

@ -3,7 +3,7 @@ on: [push, pull_request]
name: CI name: CI
env: env:
# This is required to enable the web_sys clipboard API # This is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html # https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html # https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis RUSTFLAGS: --cfg=web_sys_unstable_apis

333
Cargo.lock generated
View file

@ -8,9 +8,9 @@ checksum = "d9fe5e32de01730eb1f6b7f5b51c17e03e2325bf40a74f754f04f130043affff"
[[package]] [[package]]
name = "addr2line" name = "addr2line"
version = "0.14.0" version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7"
dependencies = [ dependencies = [
"gimli", "gimli",
] ]
@ -27,7 +27,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75b7e6a93ecd6dbd2c225154d0fa7f86205574ecaa6c87429fb5f66ee677c44" checksum = "a75b7e6a93ecd6dbd2c225154d0fa7f86205574ecaa6c87429fb5f66ee677c44"
dependencies = [ dependencies = [
"getrandom 0.2.0", "getrandom 0.2.1",
"lazy_static", "lazy_static",
"version_check", "version_check",
] ]
@ -77,6 +77,12 @@ dependencies = [
"rustc-demangle", "rustc-demangle",
] ]
[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
@ -95,12 +101,6 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byteorder"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]] [[package]]
name = "calloop" name = "calloop"
version = "0.6.5" version = "0.6.5"
@ -139,17 +139,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "chrono" name = "chunked_transfer"
version = "0.4.19" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca"
dependencies = [
"libc",
"num-integer",
"num-traits",
"time",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "clipboard" name = "clipboard"
@ -339,9 +332,9 @@ dependencies = [
[[package]] [[package]]
name = "derivative" name = "derivative"
version = "2.1.1" version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" checksum = "eaed5874effa6cde088c644ddcdcb4ffd1511391c5be4fdd7a5ccd02c7e4a183"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -391,31 +384,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]] [[package]]
name = "egui" name = "eframe"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e53b7f113b52fa8146de4f18ec93c3fb5c92250b970ef8f503372af5d737379" checksum = "e9d45b24f7ffb090780029d210f345bada5f27c1cfed650ada44e4a381f121ef"
dependencies = [
"egui",
"egui_glium",
"egui_web",
"epi",
]
[[package]]
name = "egui"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f073ba598f9a5c37d920cf934eee70f2d3bb945a2950620a5e4cd0894db69e5d"
dependencies = [ dependencies = [
"ahash", "ahash",
"atomic_refcell", "atomic_refcell",
"rusttype", "rusttype",
"serde", "serde",
"serde_json",
] ]
[[package]] [[package]]
name = "egui_glium" name = "egui_glium"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b3f7d3e73d0eedb20eb5fe0266df61136c31ece389c63e7969d9b426b5b73c" checksum = "32434c256026c89521dfa07ad58dc37eaa0693dff01b01bf064ea2b65ab173d6"
dependencies = [ dependencies = [
"chrono",
"clipboard", "clipboard",
"directories-next", "directories-next",
"egui", "egui",
"epi",
"glium", "glium",
"serde", "serde",
"serde_json", "serde_json",
"ureq",
"webbrowser", "webbrowser",
] ]
@ -423,21 +428,18 @@ dependencies = [
name = "egui_template" name = "egui_template"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"egui", "eframe",
"egui_glium",
"egui_web",
"js-sys",
"serde", "serde",
"wasm-bindgen",
] ]
[[package]] [[package]]
name = "egui_web" name = "egui_web"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10c04ed104bdc923a2de24d8ca82c397f4663640bb8461c6941034421f69964c" checksum = "0602627e30da70039d33a1fe23a566bd45a0c1450b2eabfca9e8a1b4cb33570c"
dependencies = [ dependencies = [
"egui", "egui",
"epi",
"js-sys", "js-sys",
"serde", "serde",
"serde_json", "serde_json",
@ -446,6 +448,17 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "epi"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9698a50f1c78d153f856821b2b2a6179833b64c45672529089b58ff6bb82867"
dependencies = [
"egui",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@ -467,6 +480,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
dependencies = [
"matches",
"percent-encoding",
]
[[package]] [[package]]
name = "fuchsia-zircon" name = "fuchsia-zircon"
version = "0.3.3" version = "0.3.3"
@ -485,24 +508,24 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.15" version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"libc", "libc",
"wasi 0.9.0+wasi-snapshot-preview1", "wasi 0.9.0+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"libc", "libc",
"wasi 0.9.0+wasi-snapshot-preview1", "wasi 0.10.0+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
@ -616,6 +639,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.9" version = "0.1.9"
@ -636,9 +670,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.6" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]] [[package]]
name = "jni-sys" name = "jni-sys"
@ -726,6 +760,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "matches"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]] [[package]]
name = "maybe-uninit" name = "maybe-uninit"
version = "2.0.0" version = "2.0.0"
@ -887,25 +927,6 @@ dependencies = [
"version_check", "version_check",
] ]
[[package]]
name = "num-integer"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "num_enum" name = "num_enum"
version = "0.4.3" version = "0.4.3"
@ -1072,16 +1093,44 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
dependencies = [ dependencies = [
"getrandom 0.1.15", "getrandom 0.1.16",
"redox_syscall", "redox_syscall",
] ]
[[package]]
name = "ring"
version = "0.16.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226"
dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"untrusted",
"web-sys",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.18" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
[[package]]
name = "rustls"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b"
dependencies = [
"base64",
"log",
"ring",
"sct",
"webpki",
]
[[package]] [[package]]
name = "rusttype" name = "rusttype"
version = "0.9.2" version = "0.9.2"
@ -1119,6 +1168,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sct"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c"
dependencies = [
"ring",
"untrusted",
]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.118" version = "1.0.118"
@ -1141,9 +1200,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.60" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -1168,19 +1227,18 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.5.1" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75" checksum = "1a55ca5f3b68e41c979bf8c46a6f1da892ca4db8f94023ce0bd32407573b1ac0"
[[package]] [[package]]
name = "smithay-client-toolkit" name = "smithay-client-toolkit"
version = "0.12.1" version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86d1d080d3dc98d68251d073b231dfaa200fdc2ddebc435b313ad937d0ae9dfd" checksum = "316e13a3eb853ce7bf72ad3530dc186cb2005c57c521ef5f4ada5ee4eed74de6"
dependencies = [ dependencies = [
"andrew", "andrew",
"bitflags", "bitflags",
"byteorder",
"calloop", "calloop",
"dlib", "dlib",
"lazy_static", "lazy_static",
@ -1192,6 +1250,12 @@ dependencies = [
"wayland-protocols", "wayland-protocols",
] ]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.9.3" version = "0.9.3"
@ -1200,9 +1264,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.56" version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1217,18 +1281,18 @@ checksum = "36ae8932fcfea38b7d3883ae2ab357b0d57a02caaa18ebb4f5ece08beaec4aa0"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.22" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.22" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1236,16 +1300,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "time" name = "tinyvec"
version = "0.1.44" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f"
dependencies = [ dependencies = [
"libc", "tinyvec_macros",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
] ]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.8" version = "0.5.8"
@ -1261,12 +1329,64 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc"
[[package]]
name = "unicode-bidi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
dependencies = [
"matches",
]
[[package]]
name = "unicode-normalization"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606"
dependencies = [
"tinyvec",
]
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "ureq"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e562326b32e3766fee6a4890b62489b4b095e94ac07232cfea631668002c19d7"
dependencies = [
"base64",
"chunked_transfer",
"log",
"once_cell",
"rustls",
"url",
"webpki",
"webpki-roots",
]
[[package]]
name = "url"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
dependencies = [
"form_urlencoded",
"idna",
"matches",
"percent-encoding",
]
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.2" version = "0.9.2"
@ -1364,9 +1484,9 @@ checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]] [[package]]
name = "wayland-client" name = "wayland-client"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222b227f47871e47d657c1c5e5360b4af9a877aa9c892716787be1c192c78c42" checksum = "bdbdbe01d03b2267809f3ed99495b37395387fde789e0f2ebb78e8b43f75b6d7"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"downcast-rs", "downcast-rs",
@ -1380,9 +1500,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-commons" name = "wayland-commons"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "230b3ffeda101f877ff8ecb8573f5d26e7beb345b197807c4df34ec06879a3e6" checksum = "480450f76717edd64ad04a4426280d737fc3d10a236b982df7b1aee19f0e2d56"
dependencies = [ dependencies = [
"nix", "nix",
"once_cell", "once_cell",
@ -1392,9 +1512,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-cursor" name = "wayland-cursor"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0aad1b4301cdccfb5f64056a4736e8155a5f4734bac41fdbca80b1fdbe1ab3e1" checksum = "d6eb122c160223a7660feeaf949d0100281d1279acaaed3720eb3c9894496e5f"
dependencies = [ dependencies = [
"nix", "nix",
"wayland-client", "wayland-client",
@ -1403,9 +1523,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-egl" name = "wayland-egl"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308f3ec651a099d1aa4e60625c81f67b4264d72d1b524bc7fb1a7675f7c050b4" checksum = "c653507447113c967a1aeee413699acb42d96d6302ec967c6d51930eae8aa7f5"
dependencies = [ dependencies = [
"wayland-client", "wayland-client",
"wayland-sys", "wayland-sys",
@ -1413,9 +1533,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-protocols" name = "wayland-protocols"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc16a9db803cae58b45f9a84a6cf364434cc49a95c8b1ef98ffeb467d228bdc9" checksum = "319a82b4d3054dd25acc32d9aee0f84fa95b63bc983fffe4703b6b8d47e01a30"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"wayland-client", "wayland-client",
@ -1425,9 +1545,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-scanner" name = "wayland-scanner"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee5bd43a1d746efc486515fec561e47205f328b74802b959f10f5500f7e56cc" checksum = "7010ba5767b3fcd350decc59055390b4ebe6bd1b9279a9feb1f1888987f1133d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1436,9 +1556,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-sys" name = "wayland-sys"
version = "0.28.2" version = "0.28.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0814adbecc7ea97869971e1d1c1b657e31863dda6fd768f119ad3dc408a01e58" checksum = "6793834e0c35d11fd96a97297abe03d37be627e1847da52e17d7e0e3b51cc099"
dependencies = [ dependencies = [
"dlib", "dlib",
"lazy_static", "lazy_static",
@ -1466,6 +1586,25 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "webpki"
version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376"
dependencies = [
"webpki",
]
[[package]] [[package]]
name = "widestring" name = "widestring"
version = "0.4.3" version = "0.4.3"

View file

@ -10,25 +10,14 @@ edition = "2018"
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
egui = "0.6" eframe = "0.7" # Gives us egui, epi and web+native backends
# Gives us persistence. Remove if you do like. serde = { version = "1", features = ["derive"], optional = true }
serde = { version = "1", features = ["derive"] }
# For compiling natively: [features]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] default = []
egui_glium = "0.6" http = ["eframe/http"] # Enable if you want to do http requests
persistence = ["eframe/persistence", "serde"] # Enable if you want to persist app state on shutdown
# For compiling to web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
egui_web = "0.6"
js-sys = "0.3"
wasm-bindgen = "0.2"
# [patch.crates-io]
# egui = { git = "https://github.com/emilk/egui", rev = "db3fdbe6d3c1b2baf9cb71445f8dbbf8aded0e29" } # 2020-12-26
# egui_glium = { git = "https://github.com/emilk/egui", rev = "db3fdbe6d3c1b2baf9cb71445f8dbbf8aded0e29" } # 2020-12-26
# egui_web = { git = "https://github.com/emilk/egui", rev = "db3fdbe6d3c1b2baf9cb71445f8dbbf8aded0e29" } # 2020-12-26
[profile.release] [profile.release]
opt-level = 2 # fast and small wasm opt-level = 2 # fast and small wasm

View file

@ -9,7 +9,6 @@ The goal is for this to be the simplest way to get started writing a GUI app in
You can compile your app natively or for the web, and share it using Github Pages. You can compile your app natively or for the web, and share it using Github Pages.
## Getting started ## Getting started
Start by clicking "Use this template" at https://github.com/emilk/egui_template/ or follow [these instructions](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template). Start by clicking "Use this template" at https://github.com/emilk/egui_template/ or follow [these instructions](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template).
@ -46,4 +45,4 @@ You can test the template app at <https://emilk.github.io/egui_template/>.
## Updating Egui ## Updating Egui
As of 2020, Egui is in active development with frequent releases with breaking changes. When updating Egui, update the version string in `Cargo.toml` of `egui`, `egui_glium` and `egui_web` (they should match). You can also check out the [egui_template](https://github.com/emilk/egui_template/) repository to see what changes has happened to it. As of 2020, Egui is in active development with frequent releases with breaking changes. [egui_template](https://github.com/emilk/egui_template/) will be updated in lock-step to always use the latest version of Egui.

View file

@ -6,7 +6,7 @@ set -eu
FOLDER_NAME=${PWD##*/} FOLDER_NAME=${PWD##*/}
CRATE_NAME=$FOLDER_NAME # assume crate name is the same as the folder name CRATE_NAME=$FOLDER_NAME # assume crate name is the same as the folder name
# This is required to enable the web_sys clipboard API # This is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html # https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html # https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
export RUSTFLAGS=--cfg=web_sys_unstable_apis export RUSTFLAGS=--cfg=web_sys_unstable_apis

View file

@ -2,15 +2,9 @@
# This scripts runs various CI-like checks in a convenient way. # This scripts runs various CI-like checks in a convenient way.
set -eu set -eu
# This is required to enable the web_sys clipboard API cargo check --workspace --all-targets
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html cargo check --workspace --all-features --lib --target wasm32-unknown-unknown
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
export RUSTFLAGS=--cfg=web_sys_unstable_apis
cargo check --workspace --all-targets --all-features --release
cargo fmt --all -- --check cargo fmt --all -- --check
CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all
cargo test --workspace --all-targets --all-features cargo test --workspace --all-targets --all-features
cargo test --workspace --doc cargo test --workspace --doc
cargo check --lib --target wasm32-unknown-unknown

View file

@ -213,35 +213,35 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real; return real;
} }
function __wbg_adapter_24(arg0, arg1) { function __wbg_adapter_24(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h988072f39a58fed1(arg0, arg1); wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4db4fbbc679e9fdf(arg0, arg1);
} }
function __wbg_adapter_27(arg0, arg1, arg2) { function __wbg_adapter_27(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4df5c9cb8ec7a36b(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3854978ea0066dbc(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_30(arg0, arg1, arg2) { function __wbg_adapter_30(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4df5c9cb8ec7a36b(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3854978ea0066dbc(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_33(arg0, arg1, arg2) { function __wbg_adapter_33(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4df5c9cb8ec7a36b(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3854978ea0066dbc(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_36(arg0, arg1) { function __wbg_adapter_36(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hffbede504231339c(arg0, arg1); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3854978ea0066dbc(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_39(arg0, arg1, arg2) { function __wbg_adapter_39(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4df5c9cb8ec7a36b(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h76d6ede093c07723(arg0, arg1);
} }
function __wbg_adapter_42(arg0, arg1, arg2) { function __wbg_adapter_42(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4df5c9cb8ec7a36b(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3854978ea0066dbc(arg0, arg1, addHeapObject(arg2));
} }
function __wbg_adapter_45(arg0, arg1, arg2) { function __wbg_adapter_45(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h744b8682ee5edacd(arg0, arg1, addHeapObject(arg2)); wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6f43a93dde0ee379(arg0, arg1, addHeapObject(arg2));
} }
/** /**
@ -389,45 +389,10 @@ async function init(input) {
var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2)); var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}; };
imports.wbg.__wbg_clientX_3a14a1583294607f = function(arg0) {
var ret = getObject(arg0).clientX;
return ret;
};
imports.wbg.__wbg_clientY_4b4a322b80551002 = function(arg0) {
var ret = getObject(arg0).clientY;
return ret;
};
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
var ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_addEventListener_6a37bc32387cb66d = handleError(function(arg0, arg1, arg2, arg3) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
});
imports.wbg.__wbg_deltaX_5fac4f36a42e6ec9 = function(arg0) {
var ret = getObject(arg0).deltaX;
return ret;
};
imports.wbg.__wbg_deltaY_2722120e563d3160 = function(arg0) {
var ret = getObject(arg0).deltaY;
return ret;
};
imports.wbg.__wbg_writeText_f3dba2a1b4785c80 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).writeText(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_now_7628760b7b640632 = function(arg0) { imports.wbg.__wbg_now_7628760b7b640632 = function(arg0) {
var ret = getObject(arg0).now(); var ret = getObject(arg0).now();
return ret; return ret;
}; };
imports.wbg.__wbg_pageX_7d397506a4ad73f2 = function(arg0) {
var ret = getObject(arg0).pageX;
return ret;
};
imports.wbg.__wbg_pageY_83f6542b172abf6f = function(arg0) {
var ret = getObject(arg0).pageY;
return ret;
};
imports.wbg.__wbg_instanceof_HtmlCanvasElement_7bd3ee7838f11fc3 = function(arg0) { imports.wbg.__wbg_instanceof_HtmlCanvasElement_7bd3ee7838f11fc3 = function(arg0) {
var ret = getObject(arg0) instanceof HTMLCanvasElement; var ret = getObject(arg0) instanceof HTMLCanvasElement;
return ret; return ret;
@ -450,6 +415,18 @@ async function init(input) {
var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2)); var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}); });
imports.wbg.__wbg_pageX_7d397506a4ad73f2 = function(arg0) {
var ret = getObject(arg0).pageX;
return ret;
};
imports.wbg.__wbg_pageY_83f6542b172abf6f = function(arg0) {
var ret = getObject(arg0).pageY;
return ret;
};
imports.wbg.__wbg_get_3315e8e7e59a2c40 = function(arg0, arg1) {
var ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_keyCode_47f9e9228bc483bf = function(arg0) { imports.wbg.__wbg_keyCode_47f9e9228bc483bf = function(arg0) {
var ret = getObject(arg0).keyCode; var ret = getObject(arg0).keyCode;
return ret; return ret;
@ -481,6 +458,31 @@ async function init(input) {
getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0; getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}; };
imports.wbg.__wbg_touches_3d22a22deb0f5409 = function(arg0) {
var ret = getObject(arg0).touches;
return addHeapObject(ret);
};
imports.wbg.__wbg_getData_10c8cb329803d2b8 = handleError(function(arg0, arg1, arg2, arg3) {
var ret = getObject(arg1).getData(getStringFromWasm0(arg2, arg3));
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
});
imports.wbg.__wbg_preventDefault_9aab6c264e5df3ee = function(arg0) {
getObject(arg0).preventDefault();
};
imports.wbg.__wbg_stopPropagation_697200010cec9b7e = function(arg0) {
getObject(arg0).stopPropagation();
};
imports.wbg.__wbg_clipboardData_503a7e4407c6231c = function(arg0) {
var ret = getObject(arg0).clipboardData;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_clipboard_a2f55b432ef7d0b0 = function(arg0) {
var ret = getObject(arg0).clipboard;
return addHeapObject(ret);
};
imports.wbg.__wbg_getBoundingClientRect_505844bd8eb35668 = function(arg0) { imports.wbg.__wbg_getBoundingClientRect_505844bd8eb35668 = function(arg0) {
var ret = getObject(arg0).getBoundingClientRect(); var ret = getObject(arg0).getBoundingClientRect();
return addHeapObject(ret); return addHeapObject(ret);
@ -614,35 +616,6 @@ async function init(input) {
var ret = getObject(arg0).style; var ret = getObject(arg0).style;
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbg_clipboardData_503a7e4407c6231c = function(arg0) {
var ret = getObject(arg0).clipboardData;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_getData_10c8cb329803d2b8 = handleError(function(arg0, arg1, arg2, arg3) {
var ret = getObject(arg1).getData(getStringFromWasm0(arg2, arg3));
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
});
imports.wbg.__wbg_touches_3d22a22deb0f5409 = function(arg0) {
var ret = getObject(arg0).touches;
return addHeapObject(ret);
};
imports.wbg.__wbg_get_3315e8e7e59a2c40 = function(arg0, arg1) {
var ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_preventDefault_9aab6c264e5df3ee = function(arg0) {
getObject(arg0).preventDefault();
};
imports.wbg.__wbg_stopPropagation_697200010cec9b7e = function(arg0) {
getObject(arg0).stopPropagation();
};
imports.wbg.__wbg_clipboard_a2f55b432ef7d0b0 = function(arg0) {
var ret = getObject(arg0).clipboard;
return addHeapObject(ret);
};
imports.wbg.__wbg_top_80a2533bf82e7a3e = function(arg0) { imports.wbg.__wbg_top_80a2533bf82e7a3e = function(arg0) {
var ret = getObject(arg0).top; var ret = getObject(arg0).top;
return ret; return ret;
@ -671,14 +644,37 @@ async function init(input) {
imports.wbg.__wbg_setItem_57767b71f09c3545 = handleError(function(arg0, arg1, arg2, arg3, arg4) { imports.wbg.__wbg_setItem_57767b71f09c3545 = handleError(function(arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}); });
imports.wbg.__wbg_get_85e0a3b459845fe2 = handleError(function(arg0, arg1) { imports.wbg.__wbg_clientX_3a14a1583294607f = function(arg0) {
var ret = Reflect.get(getObject(arg0), getObject(arg1)); var ret = getObject(arg0).clientX;
return ret;
};
imports.wbg.__wbg_clientY_4b4a322b80551002 = function(arg0) {
var ret = getObject(arg0).clientY;
return ret;
};
imports.wbg.__wbg_writeText_f3dba2a1b4785c80 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).writeText(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret); return addHeapObject(ret);
};
imports.wbg.__wbg_addEventListener_6a37bc32387cb66d = handleError(function(arg0, arg1, arg2, arg3) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
}); });
imports.wbg.__wbg_deltaX_5fac4f36a42e6ec9 = function(arg0) {
var ret = getObject(arg0).deltaX;
return ret;
};
imports.wbg.__wbg_deltaY_2722120e563d3160 = function(arg0) {
var ret = getObject(arg0).deltaY;
return ret;
};
imports.wbg.__wbg_call_951bd0c6d815d6f1 = handleError(function(arg0, arg1) { imports.wbg.__wbg_call_951bd0c6d815d6f1 = handleError(function(arg0, arg1) {
var ret = getObject(arg0).call(getObject(arg1)); var ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret); return addHeapObject(ret);
}); });
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
var ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_newnoargs_7c6bd521992b4022 = function(arg0, arg1) { imports.wbg.__wbg_newnoargs_7c6bd521992b4022 = function(arg0, arg1) {
var ret = new Function(getStringFromWasm0(arg0, arg1)); var ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret); return addHeapObject(ret);
@ -795,36 +791,36 @@ async function init(input) {
var ret = wasm.memory; var ret = wasm.memory;
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper426 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper311 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_24); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_24);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper427 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper312 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_27); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_27);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper430 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper314 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_30); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_30);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper432 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper316 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_33); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_33);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper434 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper319 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_36); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_36);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper436 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper321 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_39); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_39);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper438 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper323 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 86, __wbg_adapter_42); var ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_42);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper603 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper398 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 153, __wbg_adapter_45); var ret = makeMutClosure(arg0, arg1, 94, __wbg_adapter_45);
return addHeapObject(ret); return addHeapObject(ret);
}; };

Binary file not shown.

View file

@ -1,13 +1,15 @@
use eframe::{egui, epi};
/// We derive Deserialize/Serialize so we can persist app state on shutdown. /// We derive Deserialize/Serialize so we can persist app state on shutdown.
#[derive(serde::Deserialize, serde::Serialize)] #[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
pub struct EguiApp { pub struct TemplateApp {
// Example stuff: // Example stuff:
label: String, label: String,
value: f32, value: f32,
painting: Painting, painting: Painting,
} }
impl Default for EguiApp { impl Default for TemplateApp {
fn default() -> Self { fn default() -> Self {
Self { Self {
// Example stuff: // Example stuff:
@ -18,25 +20,27 @@ impl Default for EguiApp {
} }
} }
impl egui::app::App for EguiApp { impl epi::App for TemplateApp {
fn name(&self) -> &str { fn name(&self) -> &str {
"Egui Template" "Egui template"
} }
/// Called by the framework to load old app state (if any). /// Called by the framework to load old app state (if any).
fn load(&mut self, storage: &dyn egui::app::Storage) { #[cfg(feature = "persistence")]
*self = egui::app::get_value(storage, egui::app::APP_KEY).unwrap_or_default() fn load(&mut self, storage: &dyn epi::Storage) {
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
} }
/// Called by the frame work to save state before shutdown. /// Called by the frame work to save state before shutdown.
fn save(&mut self, storage: &mut dyn egui::app::Storage) { #[cfg(feature = "persistence")]
egui::app::set_value(storage, egui::app::APP_KEY, self); fn save(&mut self, storage: &mut dyn epi::Storage) {
epi::set_value(storage, epi::APP_KEY, self);
} }
/// Called each time the UI needs repainting, which may be many times per second. /// Called each time the UI needs repainting, which may be many times per second.
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. /// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
fn ui(&mut self, ctx: &egui::CtxRef, integration_context: &mut egui::app::IntegrationContext) { fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
let EguiApp { let TemplateApp {
label, label,
value, value,
painting, painting,
@ -62,7 +66,7 @@ impl egui::app::App for EguiApp {
ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| { ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| {
ui.add( ui.add(
egui::Hyperlink::new("https://github.com/emilk/egui/").text("Powered by Egui"), egui::Hyperlink::new("https://github.com/emilk/egui/").text("powered by egui"),
); );
}); });
}); });
@ -72,7 +76,7 @@ impl egui::app::App for EguiApp {
egui::menu::bar(ui, |ui| { egui::menu::bar(ui, |ui| {
egui::menu::menu(ui, "File", |ui| { egui::menu::menu(ui, "File", |ui| {
if ui.button("Quit").clicked { if ui.button("Quit").clicked {
integration_context.output.quit = true; frame.quit();
} }
}); });
}); });
@ -85,7 +89,7 @@ impl egui::app::App for EguiApp {
"https://github.com/emilk/egui_template/blob/master/", "https://github.com/emilk/egui_template/blob/master/",
"Direct link to source code." "Direct link to source code."
)); ));
egui::demos::warn_if_debug_build(ui); egui::warn_if_debug_build(ui);
ui.separator(); ui.separator();
@ -109,15 +113,15 @@ impl egui::app::App for EguiApp {
}); });
} }
// Resize the glium window to be just the size we need it to be: // Resize the native window to be just the size we need it to be:
integration_context.output.window_size = Some(ctx.used_size()); frame.set_window_size(ctx.used_size());
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/// Example code for painting on a canvas with your mouse /// Example code for painting on a canvas with your mouse
#[derive(Clone, serde::Deserialize, serde::Serialize)] #[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
struct Painting { struct Painting {
lines: Vec<Vec<egui::Vec2>>, lines: Vec<Vec<egui::Vec2>>,
stroke: egui::Stroke, stroke: egui::Stroke,
@ -127,7 +131,7 @@ impl Default for Painting {
fn default() -> Self { fn default() -> Self {
Self { Self {
lines: Default::default(), lines: Default::default(),
stroke: egui::Stroke::new(1.0, egui::color::LIGHT_BLUE), stroke: egui::Stroke::new(1.0, egui::Color32::LIGHT_BLUE),
} }
} }
} }

View file

@ -1,15 +1,15 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds #![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
#![warn(clippy::all)] #![warn(clippy::all, rust_2018_idioms)]
pub mod app; mod app;
pub use app::EguiApp; pub use app::TemplateApp;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// When compiling for web: // When compiling for web:
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*; use eframe::wasm_bindgen::{self, prelude::*};
/// This is the entry-point for all the web-assembly. /// This is the entry-point for all the web-assembly.
/// This is called once from the HTML. /// This is called once from the HTML.
@ -17,8 +17,7 @@ use wasm_bindgen::prelude::*;
/// You can add more callbacks like this if you want to call in to your code. /// You can add more callbacks like this if you want to call in to your code.
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
#[wasm_bindgen] #[wasm_bindgen]
pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> { pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
let app = EguiApp::default(); let app = TemplateApp::default();
egui_web::start(canvas_id, Box::new(app))?; eframe::start_web(canvas_id, Box::new(app))
Ok(())
} }

View file

@ -1,9 +1,10 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds #![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
#![warn(clippy::all)] #![warn(clippy::all, rust_2018_idioms)]
// When compiling natively: // When compiling natively:
#[cfg(not(target_arch = "wasm32"))]
fn main() { fn main() {
let app = egui_template::EguiApp::default(); let app = egui_template::TemplateApp::default();
egui_glium::run(Box::new(app)); eframe::run_native(Box::new(app));
} }