generated from emilk/eframe_template
-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web refactor and custom eframe and egui-wgpu #70
Merged
Merged
Conversation
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
Yes, I know it just renders a black rectangle right now. I'm getting to the rest.
Relaxed ordering should be fine here.
We never need to acquire a read lock on `WORKER_DATA`.
This is something that eframe's original web runner supported that the web worker runner didn't. It allows users to control Luminol via a touchscreen display (like the one on the Microsoft Surface). Chromium-based browsers have a "Device Mode" that emulates touch events for those who lack devices with touchscreen displays.
This text agent allows eframe to trigger the onscreen keyboard (for devices that lack a keyboard) and/or input method editor (for e.g. Chinese/Japanese/Korean input) when the user edits an egui `TextEdit` in web builds.
This allows TTS to work properly in web builds if it's enabled.
This reduces the amount of arguments we have to pass around.
This prevents these keyboard shortcuts from performing their default behaviour in web browsers so we can use them in Luminol.
This encases all of the main thread event handlers for the web filesystem in async blocks so that they can use the `?` operator for proper error handling.
Under rare circumstances, flume channel senders can block. This absolutely cannot happen on the main thread, so we need to force flume to use spinlocks instead of mutexes. Enabling spinlocks doesn't seem to change the way flume receivers' blocking receive method works, which is good.
Flume's global spinlock uses `thread::sleep` which is not allowed in WebAssembly, so I've removed `thread::sleep` from the spinlock.
Do or do not. There is no try. Any instances of these borrows failing are unambiguous errors since they all run on the main thread, so trying here is doing more harm than good.
This prevents us from having to change main.rs every time the channels change.
I put these there originally so that I can do an easy replace with `pub(super)` later if I needed to move things around.
This removes the name of the project file from the recent projects menu in web for consistency with native.
melody-rs
approved these changes
Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Description
This pull request adds modified versions of eframe and egui-wgpu into the crates directory after renaming the packages to luminol-eframe and luminol-egui-wgpu. The web runner has also been merged into eframe, including the change from a mutex to
AtomicF64
for the time (although the removing of this lock is not strictly required because the web runner's time is inaccessible from the main thread).The first commit in this pull request just adds eframe and egui-wgpu verbatim into the crates directory, so if you want to see the actual changes I made to those crates, use this comparison that excludes that commit: 498cd2b...c5a4b1b
Here is the list of other significant refactoring that was done to the web code:
There are also some new related features and bug fixes:
(egui's font doesn't support CJK characters, but I'll address this later.)This was fixed by #71.Testing
In addition to generally checking that nothing in the web version of Luminol broke, to test the flume thing, try running the web version of Luminol before and after the changes in this pull request to see if the flume crash happens, or alternatively use the example I posted in the flume issue before and after patching flume in Cargo.toml with the forked version of flume. To test the text agent, install any IME and use it to type into the text boxes in the map picker or script editor in a web build. ArchWiki has a list of some Linux IMEs used for CJK/Indic input, but there are probably more for things like handwriting recognition.
Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
cargo build --release
trunk build --release