-
Notifications
You must be signed in to change notification settings - Fork 1
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 Shell Clean up #61
Comments
I would recommend outputting <title>pntr_app</title>
<style>
body {
margin: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
height: 100vh;
user-select: none;
padding: 0 10px;
}
canvas {
flex: 1;
object-fit: contain;
}
</style>
<canvas id="screen_canvas" />
<script type="module">
import loadDemo from './whatever.mjs'
await loadDemo({canvas: screen_canvas })
</script> I made a little demo that shows what it looks like: Style can be adjusted a bit to fit the demo better, but this will try it's best to fit all the canvases on the screen, centered, using only CSS (no resize-handler.) In my projects, I just ignore the emscripten template/shell setup, and output mjs directly. This makes very nice self-contained module that you can load multiple instances of in a page, just give each it's own canvas. This can be really nice for a big page with lots of demos. I am using some tricks to short-hand here:
The web target will update the canvas-size itself, and even set the window-title, so whatever you add to title doesn't matter (but I like to set a default title, for while it's loading) and I think we should put the webroot in docs/ and update the settings for Github Pages, so we can have a nice demo URL. |
If we have multiple demos (#10), we can also use hash-routing, like I setup here: |
I also did a thing on a null0 demo (which is also another example of a more minimal web shell) where I add a little speaker icon to mean "sound cannot play yet" but if you click on it, it changes. I set the opacity kinda low, to keep it subtle, and would check if audio can play before trying to play. I think it could actually just remove the icon completely, once it's clicked, and it would look great. I also noticed fullscreen and suspend/resume don't really work right on the auto-generated HTML. I think suspend/resume is an asyncify thing (which I don't think we should add unless we really need it) but a fullscreen button could also be added as an overlay to canvas.
Here are some related icons from tabler: |
It's using raylib's shell right now, but It hink it would be good to do a minimal one or something....
https://github.com/emscripten-core/emscripten/blob/main/src/shell_minimal.html
The text was updated successfully, but these errors were encountered: