base qgui version

This commit is contained in:
kirjavascript 2022-06-06 16:48:35 +01:00
parent 3e579332af
commit e26576b436
33 changed files with 356 additions and 513 deletions

93
Cargo.lock generated
View file

@ -36,6 +36,15 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "arboard"
version = "2.1.1"
@ -219,6 +228,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if 1.0.0",
"wasm-bindgen",
]
[[package]]
name = "core-foundation"
version = "0.7.0"
@ -569,6 +588,19 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "frontend"
version = "0.1.0"
dependencies = [
"console_error_panic_hook",
"eframe",
"egui",
"emu",
"serde",
"tracing-subscriber",
"tracing-wasm",
]
[[package]]
name = "gethostname"
version = "0.2.3"
@ -1268,6 +1300,15 @@ dependencies = [
"syn",
]
[[package]]
name = "sharded-slab"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
dependencies = [
"lazy_static 1.4.0",
]
[[package]]
name = "shared_library"
version = "0.1.9"
@ -1355,6 +1396,15 @@ dependencies = [
"syn",
]
[[package]]
name = "thread_local"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
dependencies = [
"once_cell",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
@ -1409,14 +1459,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
dependencies = [
"lazy_static 1.4.0",
"valuable",
]
[[package]]
name = "truelmao-ui"
version = "0.1.0"
name = "tracing-log"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
dependencies = [
"eframe",
"egui",
"lazy_static 1.4.0",
"log",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
dependencies = [
"ansi_term",
"sharded-slab",
"smallvec",
"thread_local",
"tracing-core",
"tracing-log",
]
[[package]]
name = "tracing-wasm"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07"
dependencies = [
"tracing",
"tracing-subscriber",
"wasm-bindgen",
]
[[package]]
@ -1458,6 +1537,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "version_check"
version = "0.9.4"

View file

@ -4,10 +4,9 @@ members = [
"emu",
"web",
"desktop",
"egui",
"frontend",
]
[profile.release]
opt-level = 2
# lto = true
# opt-level = 3
# debug = true

View file

@ -1,46 +0,0 @@
[package]
name = "eframe_template"
default-run = "eframe_template_bin"
version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
edition = "2021"
rust-version = "1.60"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "eframe_template_bin"
path = "src/main.rs"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
egui = "0.18.0"
eframe = { version = "0.18.0", features = ["persistence"] }
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tracing-subscriber = "0.3"
# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2"
[profile.release]
opt-level = 2 # fast and small wasm
[patch.crates-io]
# If you want to use the bleeding edge version of egui and eframe:
# egui = { git = "https://github.com/emilk/egui", branch = "master" }
# eframe = { git = "https://github.com/emilk/egui", branch = "master" }
# If you fork https://github.com/emilk/egui you can test with:
# egui = { path = "../egui/egui" }
# eframe = { path = "../egui/eframe" }

View file

@ -1,78 +0,0 @@
@echo off
SET script_path=%~dp0
cd %script_path%
SET OPEN=0
SET FAST=0
:do_while
IF (%1) == () GOTO end_while
IF %1 == -h GOTO print_help
IF %1 == --help GOTO print_help
IF %1 == --fast (
SET FAST=1
SHIFT
GOTO do_while
)
IF %1 == --open (
SET OPEN=1
SHIFT
GOTO do_while
)
echo Unknown command "%1"
:end_while
@REM call this first : `./setup_web.bat`
for %%I in (.) do SET FOLDER_NAME=%%~nxI
@REM assume crate name is the same as the folder name
SET CRATE_NAME=%FOLDER_NAME%
@REM for those who name crates with-kebab-case
SET CRATE_NAME_SNAKE_CASE=%FOLDER_NAME:-=_%
@REM This is required to enable the web_sys clipboard API which egui_web uses
@REM https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
@REM https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
SET RUSTFLAGS=--cfg=web_sys_unstable_apis
@REM Clear output from old stuff:
DEL /F docs\%CRATE_NAME_SNAKE_CASE%_bg.wasm
echo Building rust...
SET BUILD=release
cargo build -p %CRATE_NAME% --release --lib --target wasm32-unknown-unknown
@REM Get the output directory (in the workspace it is in another location)
FOR /F "delims=" %%i IN ('cargo metadata --format-version=1 ^| jq --raw-output .target_directory') DO SET TARGET=%%i
echo Generating JS bindings for wasm...
SET TARGET_NAME=%CRATE_NAME_SNAKE_CASE%.wasm
wasm-bindgen "%TARGET%\wasm32-unknown-unknown\%BUILD%\%TARGET_NAME%" --out-dir "docs" --no-modules --no-typescript
IF %FAST% == 0 (
echo Optimizing wasm...
@REM to get wasm-opt: apt/brew/dnf install binaryen
@REM add -g to get debug symbols :
wasm-opt "docs\%CRATE_NAME%_bg.wasm" -O2 --fast-math -o "docs\%CRATE_NAME%_bg.wasm"
)
echo Finished: docs/%CRATE_NAME_SNAKE_CASE%.wasm"
IF %OPEN% == 1 start http://localhost:8080/index.html
GOTO end_program
:print_help
echo build_web.sh [--fast] [--open]
echo --fast: skip optimization step
echo --open: open the result in a browser
GOTO end_program
:end_program

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View file

@ -1,27 +0,0 @@
{
"name": "Egui Template PWA",
"short_name": "egui-template-pwa",
"icons": [{
"src": "./icon-256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "./maskable_icon_x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "./icon-1024.png",
"sizes": "1024x1024",
"type": "image/png"
}
],
"lang": "en-US",
"id": "/index.html",
"start_url": "./index.html",
"display": "standalone",
"background_color": "white",
"theme_color": "white"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

View file

@ -1,25 +0,0 @@
var cacheName = 'egui-template-pwa';
var filesToCache = [
'./',
'./index.html',
'./eframe_template.js',
'./eframe_template_bg.wasm',
];
/* Start the service worker and cache all of the app's content */
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open(cacheName).then(function (cache) {
return cache.addAll(filesToCache);
})
);
});
/* Serve cached content when offline */
self.addEventListener('fetch', function (e) {
e.respondWith(
caches.match(e.request).then(function (response) {
return response || fetch(e.request);
})
);
});

View file

@ -1,7 +0,0 @@
@REM Pre-requisites:
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli
cargo update -p wasm-bindgen
@REM For local tests with `./start_server`:
cargo install basic-http-server

View file

@ -1,11 +0,0 @@
@echo off
@REM Starts a local web-server that serves the contents of the `doc/` folder,
@REM which is the folder to where the web version is compiled.
cargo install basic-http-server
echo "open http://localhost:8080"
(cd docs && basic-http-server --addr 127.0.0.1:8080 .)
@REM (cd docs && python3 -m http.server 8080 --bind 127.0.0.1)

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -eu
# Starts a local web-server that serves the contents of the `doc/` folder,
# which is the folder to where the web version is compiled.
cargo install basic-http-server
echo "open http://localhost:8080"
(cd docs && basic-http-server --addr 127.0.0.1:8080 .)
# (cd docs && python3 -m http.server 8080 --bind 127.0.0.1)

View file

@ -1,10 +0,0 @@
[package]
name = "truelmao-ui"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
egui = "0.18.0"
eframe = { version = "0.18.0", features = ["persistence"] }

View file

@ -1,53 +0,0 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::egui;
fn main() {
let options = eframe::NativeOptions::default();
eframe::run_native(
"My egui App",
options,
Box::new(|_cc| Box::new(MyApp::default())),
);
}
struct MyApp {
name: String,
age: u32,
}
impl Default for MyApp {
fn default() -> Self {
Self {
name: "Arthur".to_owned(),
age: 42,
}
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
// println!("{:#?}", 123);
// ctx.request_repaint();
let texture: &egui::TextureHandle = &ui.ctx().load_texture(
"example",
egui::ColorImage::example(),
);
let img_size = 1024.0 * texture.size_vec2() / texture.size_vec2().y;
ui.image(texture, img_size);
ui.heading("My egui Application");
ui.horizontal(|ui| {
ui.label("Your name: ");
ui.text_edit_singleline(&mut self.name);
});
ui.add(egui::Slider::new(&mut self.age, 0..=120).text("age"));
if ui.button("Click each year").clicked() {
self.age += 1;
}
ui.label(format!("Hello '{}', age {}", self.name, self.age));
});
}
}

View file

@ -420,7 +420,7 @@ dependencies = [
]
[[package]]
name = "eframe_template"
name = "frontend"
version = "0.1.0"
dependencies = [
"console_error_panic_hook",

28
frontend/Cargo.toml Normal file
View file

@ -0,0 +1,28 @@
[package]
name = "frontend"
default-run = "frontend_bin"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "frontend_bin"
path = "src/main.rs"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
emu = { path = "../emu" }
egui = "0.18.0"
eframe = { version = "0.18.0", features = ["persistence"] }
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tracing-subscriber = "0.3"
# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2"

View file

@ -1,7 +1,7 @@
# eframe template
[![dependency status](https://deps.rs/repo/github/emilk/eframe_template/status.svg)](https://deps.rs/repo/github/emilk/eframe_template)
[![Build Status](https://github.com/emilk/eframe_template/workflows/CI/badge.svg)](https://github.com/emilk/eframe_template/actions?workflow=CI)
[![dependency status](https://deps.rs/repo/github/emilk/frontend/status.svg)](https://deps.rs/repo/github/emilk/frontend)
[![Build Status](https://github.com/emilk/frontend/workflows/CI/badge.svg)](https://github.com/emilk/frontend/actions?workflow=CI)
This is a template repo for [eframe](https://github.com/emilk/egui/tree/master/eframe), a framework for writing apps using [egui](https://github.com/emilk/egui/).
@ -11,24 +11,24 @@ You can compile your app natively or for the web, and share it using Github Page
## Getting started
Start by clicking "Use this template" at https://github.com/emilk/eframe_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/frontend/ 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).
Change the name of the crate: Chose a good name for your project, and change the name to it in:
* `Cargo.toml`
* Change the `package.name` from `eframe_template` to `your_crate`
* Change the `package.name` from `frontend` to `your_crate`
* Change the `package.authors`
* Change the `package.default-run` from `eframe_template_bin` to `your_crate_bin` (note the `_bin`!)
* Change the `bin.name` from `eframe_template_bin` to `your_crate_bin` (note the `_bin`!)
* Change the `package.default-run` from `frontend_bin` to `your_crate_bin` (note the `_bin`!)
* Change the `bin.name` from `frontend_bin` to `your_crate_bin` (note the `_bin`!)
* `main.rs`
* Change `eframe_template::TemplateApp` to `your_crate::TemplateApp`
* Change `frontend::TemplateApp` to `your_crate::TemplateApp`
* `docs/index.html`
* Change the `<title>`
* Change the `<script src=…` line from `eframe_template.js` to `your_crate.js`
* Change the `wasm_bindgen(…` line from `eframe_template_bg.wasm` to `your_crate_bg.wasm` (note the `_bg`!)
* Change the `<script src=…` line from `frontend.js` to `your_crate.js`
* Change the `wasm_bindgen(…` line from `frontend_bg.wasm` to `your_crate_bg.wasm` (note the `_bg`!)
* `docs/sw.js`
* Change the `'./eframe_template.js'` to `./your_crate.js` (in `filesToCache` array)
* Change the `'./eframe_template_bg.wasm'` to `./your_crate_bg.wasm` (in `filesToCache` array)
* Remove the web build of the old name: `rm docs/eframe_template*`
* Change the `'./frontend.js'` to `./your_crate.js` (in `filesToCache` array)
* Change the `'./frontend_bg.wasm'` to `./your_crate_bg.wasm` (in `filesToCache` array)
* Remove the web build of the old name: `rm docs/frontend*`
### Learning about egui
@ -72,14 +72,14 @@ open http://127.0.0.1:8080/
The finished web app is found in the `docs/` folder (this is so that you can easily share it with [GitHub Pages](https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site)). It consists of three files:
* `index.html`: A few lines of HTML, CSS and JS that loads your app. **You need to edit this** (once) to replace `eframe_template` with the name of your crate!
* `index.html`: A few lines of HTML, CSS and JS that loads your app. **You need to edit this** (once) to replace `frontend` with the name of your crate!
* `your_crate_bg.wasm`: What the Rust code compiles to.
* `your_crate.js`: Auto-generated binding between Rust and JS.
You can test the template app at <https://emilk.github.io/eframe_template/>.
You can test the template app at <https://emilk.github.io/frontend/>.
## Updating egui
As of 2022, egui is in active development with frequent releases with breaking changes. [eframe_template](https://github.com/emilk/eframe_template/) will be updated in lock-step to always use the latest version of egui.
As of 2022, egui is in active development with frequent releases with breaking changes. [frontend](https://github.com/emilk/frontend/) will be updated in lock-step to always use the latest version of egui.
When updating `egui` and `eframe` it is recommended you do so one version at the time, and read about the changes in [the egui changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md) and [eframe changelog](https://github.com/emilk/egui/blob/master/eframe/CHANGELOG.md).

View file

@ -57,7 +57,8 @@ wasm-bindgen "${WASM_PATH}" --out-dir docs --no-modules --no-typescript
if [[ "${FAST}" == false ]]; then
echo "Optimizing wasm…"
# to get wasm-opt: apt/brew/dnf install binaryen
wasm-opt "docs/${CRATE_NAME}_bg.wasm" -O2 --fast-math -o "docs/${CRATE_NAME}_bg.wasm" # add -g to get debug symbols
# https://github.com/WebAssembly/binaryen/releases
./wasm-opt "docs/${CRATE_NAME}_bg.wasm" -O2 --fast-math -o "docs/${CRATE_NAME}_bg.wasm" # add -g to get debug symbols
fi
echo "Finished: docs/${CRATE_NAME_SNAKE_CASE}.wasm"

View file

@ -1,3 +1,3 @@
This folder contains the files required for the web app.
The reason the folder is called "docs" is because that is the name that GitHub requires in order to host a web page from the `master` branch of a repository. You can test the `eframe_template` at <https://emilk.github.io/eframe_template/>.
The reason the folder is called "docs" is because that is the name that GitHub requires in order to host a web page from the `master` branch of a repository. You can test the `frontend` at <https://emilk.github.io/frontend/>.

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -212,22 +212,10 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_24(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9760a9c9e2626dab(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_27(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a1da0920468fcb4(arg0, arg1);
}
function __wbg_adapter_30(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9760a9c9e2626dab(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_33(arg0, arg1) {
function __wbg_adapter_24(arg0, arg1) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd62005321deefe7f(retptr, arg0, arg1);
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h344b4850b9a4b9c7(retptr, arg0, arg1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
@ -238,8 +226,20 @@ function __wbg_adapter_33(arg0, arg1) {
}
}
function __wbg_adapter_27(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3dafae52d1e1c889(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_30(arg0, arg1) {
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he9c208075855233b(arg0, arg1);
}
function __wbg_adapter_33(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3dafae52d1e1c889(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_36(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha2f39f81315ed630(arg0, arg1, addHeapObject(arg2));
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4261a5d2bf8cbb95(arg0, arg1, addHeapObject(arg2));
}
/**
@ -362,6 +362,15 @@ async function init(input) {
wasm.__wbindgen_free(arg0, arg1);
}
};
imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
@ -376,15 +385,6 @@ async function init(input) {
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
@ -642,13 +642,40 @@ async function init(input) {
const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
return ret;
}, arguments) };
imports.wbg.__wbg_type_d73ca5f20cbe175f = function(arg0, arg1) {
const ret = getObject(arg1).type;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_dataTransfer_a9eebb31aa4055f2 = function(arg0) {
const ret = getObject(arg0).dataTransfer;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_bindVertexArrayOES_35d97084dfc5f6f4 = function(arg0, arg1) {
getObject(arg0).bindVertexArrayOES(getObject(arg1));
};
imports.wbg.__wbg_createVertexArrayOES_69c38b2b74e927fa = function(arg0) {
const ret = getObject(arg0).createVertexArrayOES();
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_deltaX_692299f5e35cfb0d = function(arg0) {
const ret = getObject(arg0).deltaX;
return ret;
};
imports.wbg.__wbg_deltaY_f78bae9413139a24 = function(arg0) {
const ret = getObject(arg0).deltaY;
return ret;
};
imports.wbg.__wbg_deltaMode_08c2fcea70146506 = function(arg0) {
const ret = getObject(arg0).deltaMode;
return ret;
};
imports.wbg.__wbg_writeText_df83b2c8a773a84a = function(arg0, arg1, arg2) {
const ret = getObject(arg0).writeText(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_addEventListener_78d3aa7e06ee5b73 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
}, arguments) };
imports.wbg.__wbg_matches_7809d58d7a13e2eb = function(arg0) {
const ret = getObject(arg0).matches;
return ret;
@ -689,9 +716,9 @@ async function init(input) {
imports.wbg.__wbg_setvalue_649eb7de76d4a493 = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
const ret = getObject(arg0);
return addHeapObject(ret);
imports.wbg.__wbg_now_20d2aadcf3cc17f7 = function(arg0) {
const ret = getObject(arg0).now();
return ret;
};
imports.wbg.__wbg_items_ab2c5110450d2c6a = function(arg0) {
const ret = getObject(arg0).items;
@ -716,29 +743,9 @@ async function init(input) {
const ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_length_ced2607e299e48b0 = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_get_bbde85c2e4ce9183 = function(arg0, arg1) {
const ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_now_20d2aadcf3cc17f7 = function(arg0) {
const ret = getObject(arg0).now();
return ret;
};
imports.wbg.__wbg_length_86a84abd1008e3f0 = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_item_5cffd6d67fb3a3a3 = function(arg0, arg1) {
const ret = getObject(arg0).item(arg1 >>> 0);
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_get_8a239117b507dd81 = function(arg0, arg1) {
const ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
const ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbg_preventDefault_747982fd5fe3b6d0 = function(arg0) {
getObject(arg0).preventDefault();
@ -757,6 +764,36 @@ async function init(input) {
const ret = getObject(arg0).lastModified;
return ret;
};
imports.wbg.__wbg_length_ced2607e299e48b0 = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_get_bbde85c2e4ce9183 = function(arg0, arg1) {
const ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef = function(arg0) {
const ret = getObject(arg0) instanceof HTMLCanvasElement;
return ret;
};
imports.wbg.__wbg_width_20b7a9ebdd5f4232 = function(arg0) {
const ret = getObject(arg0).width;
return ret;
};
imports.wbg.__wbg_setwidth_654d8adcd4979eed = function(arg0, arg1) {
getObject(arg0).width = arg1 >>> 0;
};
imports.wbg.__wbg_height_57f43816c2227a89 = function(arg0) {
const ret = getObject(arg0).height;
return ret;
};
imports.wbg.__wbg_setheight_2b662384bfacb65c = function(arg0, arg1) {
getObject(arg0).height = arg1 >>> 0;
};
imports.wbg.__wbg_getContext_0c19ba5c037e057f = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_keyCode_9bdbab45f06fb085 = function(arg0) {
const ret = getObject(arg0).keyCode;
return ret;
@ -799,55 +836,17 @@ async function init(input) {
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_clipboardData_a95ca12e53577c09 = function(arg0) {
const ret = getObject(arg0).clipboardData;
imports.wbg.__wbg_length_86a84abd1008e3f0 = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_item_5cffd6d67fb3a3a3 = function(arg0, arg1) {
const ret = getObject(arg0).item(arg1 >>> 0);
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_width_a260098679e33e90 = function(arg0) {
const ret = getObject(arg0).width;
return ret;
};
imports.wbg.__wbg_height_1f8574470ebe45c9 = function(arg0) {
const ret = getObject(arg0).height;
return ret;
};
imports.wbg.__wbg_top_da39668ed41161c4 = function(arg0) {
const ret = getObject(arg0).top;
return ret;
};
imports.wbg.__wbg_left_a1624a1a425102f3 = function(arg0) {
const ret = getObject(arg0).left;
return ret;
};
imports.wbg.__wbg_instanceof_HtmlCanvasElement_b94545433bb4d2ef = function(arg0) {
const ret = getObject(arg0) instanceof HTMLCanvasElement;
return ret;
};
imports.wbg.__wbg_width_20b7a9ebdd5f4232 = function(arg0) {
const ret = getObject(arg0).width;
return ret;
};
imports.wbg.__wbg_setwidth_654d8adcd4979eed = function(arg0, arg1) {
getObject(arg0).width = arg1 >>> 0;
};
imports.wbg.__wbg_height_57f43816c2227a89 = function(arg0) {
const ret = getObject(arg0).height;
return ret;
};
imports.wbg.__wbg_setheight_2b662384bfacb65c = function(arg0, arg1) {
getObject(arg0).height = arg1 >>> 0;
};
imports.wbg.__wbg_getContext_0c19ba5c037e057f = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
imports.wbg.__wbg_get_8a239117b507dd81 = function(arg0, arg1) {
const ret = getObject(arg0)[arg1 >>> 0];
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_touches_d4869a7500017809 = function(arg0) {
const ret = getObject(arg0).touches;
return addHeapObject(ret);
};
imports.wbg.__wbg_changedTouches_21bd59fbbc482ad7 = function(arg0) {
const ret = getObject(arg0).changedTouches;
return addHeapObject(ret);
};
imports.wbg.__wbg_body_2a1ff14b05042a51 = function(arg0) {
const ret = getObject(arg0).body;
@ -1095,6 +1094,30 @@ async function init(input) {
imports.wbg.__wbg_focus_42ad8e77a7a0b22a = function() { return handleError(function (arg0) {
getObject(arg0).focus();
}, arguments) };
imports.wbg.__wbg_clipboardData_a95ca12e53577c09 = function(arg0) {
const ret = getObject(arg0).clipboardData;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_top_da39668ed41161c4 = function(arg0) {
const ret = getObject(arg0).top;
return ret;
};
imports.wbg.__wbg_left_a1624a1a425102f3 = function(arg0) {
const ret = getObject(arg0).left;
return ret;
};
imports.wbg.__wbg_appendChild_a86c0da8d152eae4 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).appendChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_touches_d4869a7500017809 = function(arg0) {
const ret = getObject(arg0).touches;
return addHeapObject(ret);
};
imports.wbg.__wbg_changedTouches_21bd59fbbc482ad7 = function(arg0) {
const ret = getObject(arg0).changedTouches;
return addHeapObject(ret);
};
imports.wbg.__wbg_size_e8d6777bbbbd2991 = function(arg0) {
const ret = getObject(arg0).size;
return ret;
@ -1103,6 +1126,37 @@ async function init(input) {
const ret = getObject(arg0).arrayBuffer();
return addHeapObject(ret);
};
imports.wbg.__wbg_width_a260098679e33e90 = function(arg0) {
const ret = getObject(arg0).width;
return ret;
};
imports.wbg.__wbg_height_1f8574470ebe45c9 = function(arg0) {
const ret = getObject(arg0).height;
return ret;
};
imports.wbg.__wbg_addEventListener_78d3aa7e06ee5b73 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
}, arguments) };
imports.wbg.__wbg_getItem_eb6e17b18b890a47 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_setItem_ed2ea572329ab721 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_data_ccaf50f3288b08c5 = function(arg0, arg1) {
const ret = getObject(arg1).data;
var ptr0 = isLikeNone(ret) ? 0 : 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_setProperty_ae9adf5d00216c03 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_href_ee02b91ff794f1c0 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).href;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@ -1159,37 +1213,6 @@ async function init(input) {
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_appendChild_a86c0da8d152eae4 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).appendChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_getItem_eb6e17b18b890a47 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_setItem_ed2ea572329ab721 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_data_ccaf50f3288b08c5 = function(arg0, arg1) {
const ret = getObject(arg1).data;
var ptr0 = isLikeNone(ret) ? 0 : 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_setProperty_ae9adf5d00216c03 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_type_d73ca5f20cbe175f = function(arg0, arg1) {
const ret = getObject(arg1).type;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_clientX_83648828186ba19f = function(arg0) {
const ret = getObject(arg0).clientX;
return ret;
@ -1214,29 +1237,6 @@ async function init(input) {
const ret = getObject(arg0).button;
return ret;
};
imports.wbg.__wbg_dataTransfer_a9eebb31aa4055f2 = function(arg0) {
const ret = getObject(arg0).dataTransfer;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_bindVertexArrayOES_35d97084dfc5f6f4 = function(arg0, arg1) {
getObject(arg0).bindVertexArrayOES(getObject(arg1));
};
imports.wbg.__wbg_createVertexArrayOES_69c38b2b74e927fa = function(arg0) {
const ret = getObject(arg0).createVertexArrayOES();
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_deltaX_692299f5e35cfb0d = function(arg0) {
const ret = getObject(arg0).deltaX;
return ret;
};
imports.wbg.__wbg_deltaY_f78bae9413139a24 = function(arg0) {
const ret = getObject(arg0).deltaY;
return ret;
};
imports.wbg.__wbg_deltaMode_08c2fcea70146506 = function(arg0) {
const ret = getObject(arg0).deltaMode;
return ret;
};
imports.wbg.__wbg_get_590a2cd912f2ae46 = function(arg0, arg1) {
const ret = getObject(arg0)[arg1 >>> 0];
return addHeapObject(ret);
@ -1253,18 +1253,6 @@ async function init(input) {
const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
const ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
const ret = getObject(arg0).then(getObject(arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
@ -1285,6 +1273,18 @@ async function init(input) {
const ret = getObject(arg0) === undefined;
return ret;
};
imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
const ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
const ret = getObject(arg0).then(getObject(arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
const ret = getObject(arg0).buffer;
return addHeapObject(ret);
@ -1342,24 +1342,24 @@ async function init(input) {
const ret = wasm.memory;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper851 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_24);
imports.wbg.__wbindgen_closure_wrapper821 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 215, __wbg_adapter_24);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper852 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_27);
imports.wbg.__wbindgen_closure_wrapper823 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 215, __wbg_adapter_27);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper853 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_30);
imports.wbg.__wbindgen_closure_wrapper825 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 215, __wbg_adapter_30);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper862 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 230, __wbg_adapter_33);
imports.wbg.__wbindgen_closure_wrapper827 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 215, __wbg_adapter_33);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1062 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 346, __wbg_adapter_36);
imports.wbg.__wbindgen_closure_wrapper1040 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 338, __wbg_adapter_36);
return addHeapObject(ret);
};

Binary file not shown.

View file

@ -121,14 +121,14 @@
</script>
<!-- this is the JS generated by the `wasm-bindgen` CLI tool -->
<script src="eframe_template.js"></script>
<script src="frontend.js"></script>
<script>
// We'll defer our execution until the wasm is ready to go.
// Here we tell bindgen the path to the wasm file so it can start
// initialization and return to us a promise when it's done.
console.debug("loading wasm…");
wasm_bindgen("./eframe_template_bg.wasm")
wasm_bindgen("./frontend_bg.wasm")
.then(on_wasm_loaded)
.catch(on_wasm_error);
@ -143,6 +143,7 @@
}
function on_wasm_error(error) {
console.log(error);
console.error("Failed to start: " + error);
document.getElementById("center_text").innerHTML = `
<p>
@ -156,18 +157,6 @@
</p>`;
}
</script>
<!--Register Service Worker-->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js');
});
}
</script>
</body>
</html>
<!-- Powered by egui: https://github.com/emilk/egui/ -->

View file

@ -5,6 +5,3 @@ set -eu
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli
cargo update -p wasm-bindgen
# For local tests with `./start_server`:
cargo install basic-http-server

View file

@ -1,21 +1,28 @@
use emu::Megadrive;
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
#[derive(serde::Deserialize, serde::Serialize)]
#[serde(default)] // if we add new fields, give them default values when deserializing old state
// #[derive(serde::Deserialize, serde::Serialize)]
// #[serde(default)] // if we add new fields, give them default values when deserializing old state
pub struct TemplateApp {
// Example stuff:
// #[serde(skip)]
emu: Megadrive,
label: String,
// this how you opt-out of serialization of a member
#[serde(skip)]
// #[serde(skip)]
value: f32,
}
impl Default for TemplateApp {
fn default() -> Self {
let buf: Vec<u8> = include_bytes!("/home/cake/sonic/roms/s2.bin").to_vec();
Self {
// Example stuff:
label: "Hello World!".to_owned(),
value: 2.7,
emu: Megadrive::new(buf),
}
}
}
@ -28,9 +35,9 @@ impl TemplateApp {
// Load previous app state (if any).
// Note that you must enable the `persistence` feature for this to work.
if let Some(storage) = cc.storage {
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
}
// if let Some(storage) = cc.storage {
// return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
// }
Default::default()
}
@ -38,14 +45,14 @@ impl TemplateApp {
impl eframe::App for TemplateApp {
/// Called by the frame work to save state before shutdown.
fn save(&mut self, storage: &mut dyn eframe::Storage) {
eframe::set_value(storage, eframe::APP_KEY, self);
}
// fn save(&mut self, storage: &mut dyn eframe::Storage) {
// eframe::set_value(storage, eframe::APP_KEY, self);
// }
/// 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`.
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
let Self { label, value } = self;
let Self { label, value, .. } = self;
// Examples of how to create different panels and windows.
// Pick whichever suits you.
@ -88,24 +95,30 @@ impl eframe::App for TemplateApp {
});
egui::CentralPanel::default().show(ctx, |ui| {
// The central panel the region left after adding TopPanel's and SidePanel's
ui.heading("eframe template");
ui.hyperlink("https://github.com/emilk/eframe_template");
ui.add(egui::github_link_file!(
"https://github.com/emilk/eframe_template/blob/master/",
"Source code."
));
egui::warn_if_debug_build(ui);
ctx.inspection_ui(ui);
});
if false {
egui::Window::new("Window").show(ctx, |ui| {
ui.label("Windows can be moved by dragging them.");
ui.label("They are automatically sized based on contents.");
ui.label("You can turn on resizing and scrolling if you like.");
ui.label("You would normally chose either panels OR windows.");
});
}
egui::Window::new("viewport").show(ctx, |ui| {
ui.label("Windows can be moved by dragging them.");
ui.label("They are automatically sized based on contents.");
ui.label("You can turn on resizing and scrolling if you like.");
ui.label("You would normally chose either panels OR windows.");
ctx.request_repaint();
self.emu.frame(true);
let pixels = self.emu.gfx.screen.chunks_exact(3)
.map(|p| egui::Color32::from_rgba_unmultiplied(p[0], p[1], p[2], 255))
.collect();
let texture: &egui::TextureHandle = &ui.ctx().load_texture(
"viewport",
egui::ColorImage {
size: [320, 240],
pixels,
},
);
let img_size = 400.0 * texture.size_vec2() / texture.size_vec2().y;
ui.image(texture, img_size);
});
}
}

View file

@ -11,6 +11,6 @@ fn main() {
eframe::run_native(
"eframe template",
native_options,
Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))),
Box::new(|cc| Box::new(frontend::TemplateApp::new(cc))),
);
}

BIN
frontend/wasm-opt Executable file

Binary file not shown.