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
desktop: Add GUI using egui #10426
desktop: Add GUI using egui #10426
Conversation
My rough WIP, I think, all stuff must be in the center of screen, it will be useful in full-screen mode and on high res monitors We can make buttons with any colors, include transparency of the buttons Rough "options" in ms paint. If it looks clunky (in very small window size), we can make all options just in single line in center, with drop boxes (scale, load behavior) and move "back" button in center on bottom side of screen |
This is great, thanks so much! Don't forget that we can always use the Flash projector as a reference - I think the way they did things is generally pretty good. Two issues I noticed:
Yeah, right now the background music from one game persists after loading the next game, so this is definitely needed.
The Flash projector doesn't do that, so I wouldn't consider that an essential feature, but it might be nice.
I guess we should test what the Flash projector does, I'm not sure.
It seems like mouse clicks are already blocked correctly but I guess we should do the same with hover events, etc. Finally, we should definitely look into adding some more of the Flash projector's menu options:
|
Could touch input also be looked into for the revamp if possible? According to Nosamu it doesnt work on the original desktop version of ruffle, but did on the flash player. |
I think that's quite unrelated to this PR - you should make a separate feature request for it. |
Thanks for the feedback!
I like the idea of mimicking the standalone player, and it does keep things simple! The only thought I had is that it might be useful to be able to adjust settings without exiting fullscreen mode. For example, if we have a full settings menu with things like key rebinding, etc., it might be slightly annoying to have to exit to windowed mode to fiddle with this. But possibly this is thinking ahead too much! I also have to properly resize the window and bump the player itself down to account for the menu size if the menu is always going to be visible.
To answer my own question, I was just playing through Typing of the Dead via RetroArch recently, and I like how they handle it. By default, keyboard shortcuts are captured by the UI, which is totally fine for most content. But you can press Scroll Lock to lock all keyboard input to the the game for content where it matters. |
Looking at #10434, maybe even a new option to reload the swf we're playing? |
Instead of rendering ui onto the wgpu ruffle backend, render ruffle onto a texture and project that onto the ui. This way we can have UI without a ruffle player loaded, and separation of MSAA |
I agree! This was just the easiest way to get started. |
I've rebased this onto master (with wgpu 0.16, so I've had to change the egui version to a commit ref until they release a new one). I can take a look at the TODOs too. |
Fixed!
Not easy to fix, it's because the window is "paused" (OS level) when you click it, so we aren't re-rendering and you're seeing the state of the screen before the dialog was opened.
Should be fixed. For keeping the menu bar open all the time and not overlaying the movie, it's not trivial right now but I can look into it. It'd certainly make the question of how to open it much simpler. |
This is really awesome. |
96fed9d
to
c502c7a
Compare
Opening this up for review now. It's not great, there's a lot I'd like to do in further PRs, but it should now be a strict improvement over the current desktop! |
Just tested this out and it's working great, thanks so much! From a UX standpoint I think it's definitely ready to merge. |
This crashes on startup for me on linux, X11 with the following error:
I think the code assumes that a resize event is send before rendering the window and that that isn't true on X11. surface.configure(
&descriptors.device,
&wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: surface_format,
width: 800,
height: 600,
present_mode: Default::default(),
alpha_mode: Default::default(),
view_formats: Default::default(),
},
); it starts and lets me load a movie (and resizes to the size of the movie) but crashes when I try to resize the window with the following error:
However, resizing does work when no movie is loaded. |
I'll take a look shortly, thank you! |
@thisisjonathan can you see if this commit fixes it? It's the same thing you tried but a correct width/height. I'm curious if that'll be enough or if that second crash is another issue entirely |
Starting now works correctly, but resizing still gives the same error as before. Going fullscreen with Alt-Enter does work however. |
…r unless a movie has been specified
…d the size is different
This is a rough WIP for discussion and collaboration. Code could use some cleanup as I'm still learning my way around egui.
TODO:
Currently usesfetch_root_movie
to change movies, but it'd be safer to recreate the entirePlayer
when loading a new movie for now. Have to add a method to reset and re-use some of the backends.Pause and darken movie when UI is visible.no need anymoreDecide on rules for showing the menu bar.Currently it will hide whenever a movie is playing, and holding Esc for half a second will display it.This interacts badly with full-screen mode.Other possibilities:Always showShow when mouse is at top of screenMove file picker code out ofmain
togui
(still usingrfd
)gui
Update navigator base URL when a new movie is loaded.egui rendering is done directly to the final wgpu surface so no AA and possible color space issues.Other UI crate possibilities
I'm not settled on egui as the best solution, this is experimental to see how the crate works. Open to opinions. Other possibilites:
iced_aw
.