-
Notifications
You must be signed in to change notification settings - Fork 196
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
Emscripten: Add Api and remove Asynchify #2862
Conversation
Renamed constants from EASYRPG_GAME to game and EASYRPG_FS to saveFs as this is now cleaner to do with a module. Fix passing of custom game name.
Adding an Interface class for this. For ensuring that savegames are immediately available scene refresh is now possible. The refresh will be also useful for other use cases later.
Is required for the Api extensions, otherwise they will crash because a async call is active the entire time.
Looking great 👍. There's a good chance for an emscripten PR to include a couple of changes: Pause/resume option via OSD button html shell updates by Joke: |
Module = { | ||
EASYRPG_GAME: "", | ||
|
||
// Do not replace Object.assign with "...Module". Breaks the Acorn optimizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acorn optimizer was just fixed :) emscripten-core/emscripten#18461
Wow, this PR looks promising. Unfortunately, I'm not able to help technically. |
Also added a screenshot API now that offers the screen for download. Will bind it to the screenshot key. Is suitable for ynonline which currently downloads the canvas for screenshots and this can be black for a brief moment due to how rendering works. |
- emscripten_sleep requires asynchify. - Final fixes for save and load scene. - New function for taking a screenshot and downloading it. - Fix unit tests
okay rebound the Screenshot button to do a download :) This PR is ready now. Will use the work in this PR to enhance the Fluidsynth and Font settings scene: I want to allow file "upload" so you can have custom (sound)fonts in the browser. |
Waited a year for this. Thank you all for your work. Is it Christmas already? 🎄 |
I have to amend this.
The
The problem is here that Solution seems to be: In sdl2_ui.cpp: #ifdef EMSCRIPTEN
// Only handle keyboard events when the canvas has focus
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, "#canvas");
#endif Changes on the website: // Launch the Player and configure it
window.addEventListener('load', (event) => {
createEasyRpgPlayer({
game: undefined,
saveFs: undefined
}).then(function(Module) {
// Module is ready
easyrpgPlayer = Module;
easyrpgPlayer.initApi();
canvas.focus(); // <-- NEW
// Custom code here
});
});
// Make EasyRPG player embeddable
canvas.addEventListener('mouseenter', () => canvas.focus()); // <- CHANGED
canvas.addEventListener('click', () => canvas.focus()); // <- CHANGED
|
Bump, I too am experiencing this regression related to inputs. All of my text input fields are locked up, and this no longer works to disable:
|
The fix for this is already merged. When you use a custom shell file do not forget to update it |
Already wrote this in February but never gave it the final touch... Better for post 0.7.1, removing asynchify can cause problems.
Had to remove Asynchify because it breaks the Api (you cannot call back into the Player while the endless async loop is running). Previously we had bad experiences when the browser does the mainloop timing. I hope this works better by now...
New feature: Save upload and download (fix: #1025).
New feature: Api under "easyrpgPlayer.api". Currently can do: Reset, Refresh (called after upload to refresh the scene), Upload, Download. Can be used as an extension point if you have a website that wants to access certain functionality of the Player.