-
Notifications
You must be signed in to change notification settings - Fork 421
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 Support #1243
base: devel
Are you sure you want to change the base?
Web Support #1243
Conversation
Basic implementation of async assset loading
Web Support
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.
I was looking at various Rust game engines and frameworks. I really liked ggez, but would like to target web, so I decided to test this PR. Here are some random comments 😃
sync::Arc, | ||
task::{Poll, Waker}, | ||
}; | ||
|
||
use crate::{ | ||
graphics::{Drawable, Drawable3d}, |
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.
The Drawable3d
import and an impl below will fail if feature 3d
is off.
@@ -79,6 +82,8 @@ base64 = { version = "0.21.2", optional = true } | |||
gltf = { version = "1.2.0", optional = true, default-features = false, features = ["utils"] } | |||
obj-rs = { version = "0.7.1", optional = true } | |||
num-traits = "0.2" | |||
dyn-clone = "1.0.12" | |||
ureq = "2.7.1" |
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.
Would it be possible to make ureq
an optional dependency? I understand that it is only needed for HttpFS
, and it depends transitively on ring
which is somewhat hard to cross-compile.
Also I don't think ureq
is used (or works at all) in WASM, so you could put it in [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
or something.
Nice catch I'll fix both of these up soon |
@Vixeliz I finally got around to testing and fixing some of the problems I had running this last year. Overall I think it's great work, and just needs a bit of cleanup and regression testing. I fixed the conflicts locally, as well as the comments from @metiulekm, and a few other minor build issues. Should I push directly to this branch, or is it easier if I merge a fork? Here's a dump of some of my notes I haven't had a chance to address yet:
In the <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Hello ggez!</title>
<style>
html, body {
height: 100%;
padding: 0;
margin: 0;
box-sizing: border-box;
}
#ggez-wrap {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div id="ggez-wrap">
</div>
<script type="module">
import game from "./wasm/ggez-playground";
try {
await game();
} catch(_e) {
// wgpu throws an error on init for control flow?
}
// Move canvas to our own element
const ggezWrap = document.getElementById('ggez-wrap')
const ggezBody = document.getElementById('ggez-body')
ggezWrap.appendChild(ggezBody)
</script>
</body>
</html> |
Ok here is one actually based on the branch here in the ggez repo lol.
I think we are getting close to this being ready to merge.