Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove Emscripten support #857
Conversation
cactorium
added some commits
Feb 12, 2017
This comment has been minimized.
This comment has been minimized.
|
Err.. I don't understand what you're trying to achieve, but don't duplicate winit. Just continue importing it even on emscripten, but just don't call any of its functions. |
This comment has been minimized.
This comment has been minimized.
|
That breaks because winit doesn't support emscripten:
Like it's impossible to get it to compile for emscripten, unless there's some flag or trick that I don't know about? |
This comment has been minimized.
This comment has been minimized.
|
Winit should get a "null" backend which always returns an error when you try to use it. |
This comment has been minimized.
This comment has been minimized.
|
winit's got this thing in
A fresh pull of the master branch of winit fails to compile with target
|
This comment has been minimized.
This comment has been minimized.
|
Yes, what I mean is that winit should be modified to add a "null" implementation that is used instead of this "this_platform_is_not_supported" thing. |
This comment has been minimized.
This comment has been minimized.
|
Ohhh okay, sorry! |
This comment has been minimized.
This comment has been minimized.
|
So I think I got the default platform thing working, but I can't test because of the winit API transition thing; glutin doesn't compile with either emscripten or linux against the tip of winit, with or without my changes... Any recommendations on what to do next? |
This comment has been minimized.
This comment has been minimized.
|
Oh, I forgot about that. |
tomaka
requested changes
Feb 13, 2017
| winit_builder: winit::WindowBuilder) | ||
| -> Result<Window, CreationError> { | ||
|
|
||
| let winit_window = winit_builder.build().unwrap(); |
This comment has been minimized.
This comment has been minimized.
tomaka
Feb 13, 2017
Member
The idea is that you wouldn't use winit at all. Just don't call it, and remove the winit_window field from the struct.
| @@ -190,7 +161,7 @@ impl Window { | |||
|
|
|||
| #[inline] | |||
| pub fn create_window_proxy(&self) -> WindowProxy { | |||
| WindowProxy | |||
| self.winit_window.create_window_proxy() | |||
This comment has been minimized.
This comment has been minimized.
tomaka
Feb 13, 2017
Member
It's fine to panic! here. Nobody uses the window proxy, and it's going to be removed soon.
This comment has been minimized.
This comment has been minimized.
|
Fixed both I think |
tomaka
approved these changes
Feb 13, 2017
This comment has been minimized.
This comment has been minimized.
|
So I've got some work done on adding in the hooks for mouse/keyboard events as well, would those be good to add to this PR, or would opening a new PR after this one's merged be better? |
This comment has been minimized.
This comment has been minimized.
|
@cactorium As you wish. |
cactorium
added some commits
Feb 15, 2017
This comment has been minimized.
This comment has been minimized.
|
So I guess I'll see how far I get before winit 0.5.11 gets published and submit whatever work I get done by then? Most of the event stuff should be working pretty solidly right now; the biggest hole left is converting to keys to |
cactorium
added some commits
Feb 15, 2017
This comment has been minimized.
This comment has been minimized.
|
All's ready except for the version change |
This comment has been minimized.
This comment has been minimized.
thiolliere
commented
Feb 15, 2017
|
I just want to mention that I started implementing emscripten plateform in winit there I included keyboard but mouse because there was an issue with mousemove when the cursor is grabbed |
This comment has been minimized.
This comment has been minimized.
|
I'm hesitating between putting the emscripten stuff in glutin or in winit. The initial reason why I wanted to stick to glutin is that you can only use OpenGL with emscripten anyway, and that the concept of a "window" is a bit blurry when it comes to web pages. But that's a pretty weak argument, so I'm not sure. |
This comment has been minimized.
This comment has been minimized.
|
I kind of agree with the idea of having it in glutin because of the fact
that you don't really control a window. On the other hand, I think
emscripten supports using SDL instead of OpenGL, so maybe it'd make sense
to put event processing stuff in winit to share it across the two?
On Wed, Feb 15, 2017, 11:10 AM tomaka <notifications@github.com> wrote:
I'm hesitating between putting the emscripten stuff in glutin or in winit.
The initial reason why I wanted to stick to glutin is that you can only use
OpenGL with emscripten anyway, and that the concept of a "window" is a bit
blurry when it comes to web pages.
That being said Android has the same problem where you're manipulating a
window but the whole screen.
But that's a pretty weak argument, so I'm not sure.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#857 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABcW37Qyj51Xj16U9yroFC1NCnxxbjNgks5rcyOGgaJpZM4L-nvg>
.
|
This comment has been minimized.
This comment has been minimized.
|
My bad, I missed the version bump on winit. Cargo.toml's updated |
added some commits
Mar 18, 2017
cactorium
and others
added some commits
Mar 21, 2017
This comment has been minimized.
This comment has been minimized.
thiolliere
commented
May 3, 2017
•
|
I got an issue when I use serde before building window. |
This comment has been minimized.
This comment has been minimized.
|
What errors are you getting? It looks like it runs fine on my computer |
This comment has been minimized.
This comment has been minimized.
thiolliere
commented
May 3, 2017
•
|
it works on
|
This comment has been minimized.
This comment has been minimized.
thiolliere
commented
May 3, 2017
|
I rewrite the example. Now it fails also on beta also. Also I don't know if this is the right place for discussing on this issue. I think it is related to emscripten backend itself. |
This comment has been minimized.
This comment has been minimized.
thiolliere
commented
May 8, 2017
•
|
I have an issue related to hidpi_factor. On some smartphone (I suspect with HDPI of 2) my game was only showing the bottom-left quarter of the expected view. I solved it by forcing hdpi_factor method to always return 1. Also I found that our implementation of get_inner_size is not coherent with winit implementation. I don't have any hardware with HDPI different from one to test. |
This comment has been minimized.
This comment has been minimized.
|
Would something like this fix it? You probably have more experience with dealing with emscripten than me at this point, but it looks like using
Also what versions of stuff are you running? I can't build against the latest of everything because of the new |
This comment has been minimized.
This comment has been minimized.
LukasKalbertodt
commented
Jun 28, 2017
|
Any updates on this? |
This comment has been minimized.
This comment has been minimized.
|
Not as far as I know, but the code here's dated now, since winit switched the EventLoop thing at 0.6. I'm working on redoing the work here to the latest glutin, but there hasn't been any word from the maintainers about it. My fork's master branch might be usable right now, in case anyone needs emscripten working right now |
This comment has been minimized.
This comment has been minimized.
aep
commented
Jul 4, 2017
•
|
@cactorium actually your fork doesnt work out of the box, or am i missing something?
|
This comment has been minimized.
This comment has been minimized.
|
@aep Hmm, it looks like one of the pull requests I merged broke some stuff, and I can't be bothered with trying to fix it if it'll basically be stuck at the version 0.7 anyways. It looks like "emscripten_events" still builds correctly, so I guess you could use that one for now |
This comment has been minimized.
This comment has been minimized.
|
I'm guessing this PR has been subsumed by subsequent additions to winit? |
ZeGentzy
added
the
To-Close-For-Inactivity
label
Feb 25, 2019
This comment has been minimized.
This comment has been minimized.
|
Closing for inactivity. |
cactorium commentedFeb 12, 2017
Mostly backporting winit functions into emscripten's platform module. It compiles and works against a modified version of badboy's glium example: https://github.com/cactorium/spring-crabs/tree/emscripten