u/_The_Master_Baiter_

▲ 4 r/bevy

What's the proper way to get the raw window handle of a window?

So I'm trying to make a desktop game, previously wanted it to be a fullscreen, transparent window with cursor falltrhough, but that combination is Windows only so hell nah, I want my game to work everywhere, so I've decided to simply have many tiny windows here and there for each context, that way I can avoid transparency and falltrhough, but theres an issue. I've made my own renderer with wgpu to go around some silent bugs that I couldnt figure, but because of that I need to get the raw window handle to create the surface, I didn't know how you could do it but then I checked inside of bevy_render and apparently you can query a RawHandleWrapperHolder, an then do some shenanigans to get the handle out, and that worked fine when I was creating the window from the WindowPlugin in default plugins. Now the thing is, I don't have a primary window anymore, so I start the WindowPlugin without a primary window, because I want to start inserting the windows later on. So this is how I do it for now, I have a plugin with a startup system that uses commands to spawn a Window object, togheter with a label component to know what type of window it is, and then have a system that reads On<WindowCreated> events to try and set up the renderer for each type of window. So at first I though, ok, have a query for all the RawHandleWrapperHolder, and then use message.window to get the correct handle for that window, doesnt work, so out of curiosity I make it print the length of the query with .iter().len(), its always 0, even minutes after the window is created, with the window blatantly on screen. Then I've read about how I can use WinitWindows to get the window handle, so I do NonSend<WinitWindows>, and then .get_window(), again with message.window, it crashes saying WinitWindows was none and to wrap it in Option, so I do just that, Option<NonSend<WinitWindows>>, and make it print if its is some, it always prints false, again even after minutes after the creation of the window, even though its right there on screen, so now I'm out of options, I dont know if its something to do with my setup or its just the wrong way, but I dont see why the RawHandles wont appear when adding windows with commands, but one exists if I create a window using the WindowPlugin. Help pleasee

bevy = { version = "0.18.1", default-features = false, features = ["default_app", "default_platform"] }
reddit.com
u/_The_Master_Baiter_ — 6 days ago
▲ 4 r/bevy

Can you make inputs go through the window?

I don't really know how to put it, but Im trying to make one of those games that become part of the desktop in some way, so im guessing is like fullscreen plus transparency, and thats fine, but now I need for the input to go through, otherwise its blocking everything, is there a way to do so?

reddit.com
u/_The_Master_Baiter_ — 7 days ago
▲ 6 r/bevy

Issue with size in custom renderer

So I've made a custom renderer with wgpu to get around some issues I had with bevy's renderer, but now I'm having an issue with how big stuff is being drawn. Previously with bevy I was using Mesh::from(Rectangle::new(120.0, 120.0)), along with a OrthographicProjection of scale 2, and transforms having default scale of 1, and it appeared as something like maybe a 20th of the screen? While I did drop every crate that needs the renderer including the render crate itself, I kept the bevy's camera crate because its very convenient, and I need to change less this way. So really the change now is that I need to make my vertexes myself, I quite new to wgpu in general but from what I understood to make a squre of size 120.0 by 120.0, each you need to space by half of that in every direction, so you end up with something like (60, 60), (60, -60) and so on, and thats what I did for my vertexes. Now for the camera stuff, from what I understood again, for the view matrix you use the inverse of the transform of the camera, and thats what I did, and for the projection matrix I called get_clip_from_view() on the Projection. Then I multiplied them together in this order "projection * view". Then I sent the result to the shader. In the shader I have the transform matrix of the entity im drawing and multiply it with the vertex position like this transform * vec4<f32>(vertex_position, 0.0, 1.0).
Then the result i multiply it with the camera matrix in that order, camera * result. But for some reason, instead of being the same size as it was in bevy's renderer, which was like a tiny fraction of the screen, now it might be several tens, or even hundreds of times the screen size, am I missing something?

reddit.com
u/_The_Master_Baiter_ — 10 days ago