Questions tagged [winit]
18 questions
3
votes
1 answer
How to to close a window inititated with winit, without exiting program/process?
I am using winit crate in Rust to create a new window. My program initially creates a CLI, and the GUI window is created based on an optional input from the user in CLI. How do I close the newly created window without exiting the process and closing…

nuacras
- 33
- 3
3
votes
1 answer
Getting a windows-rs HWND from winit?
I'm fairly new to Rust and am trying to get the following to work:
let hwnd : *mut HWND = window.hwnd().cast();
let swapchain = unsafe { factory.CreateSwapChainForHwnd(&device, *hwnd, &desc, std::ptr::null(), &output)? } ;
where window.hwnd()…

Nico van Bentum
- 339
- 1
- 13
2
votes
1 answer
Bevy / Winit - Open GUI Without Focus
I'm writing various graphical tests in Bevy. Each spawns the GUI, runs for a few seconds, and then exits the app and moves on to the next.
I love being able to visually check its doing what I think, but when each starts it steals focus from VS Code.…

chantey
- 4,252
- 1
- 35
- 40
2
votes
1 answer
How do I use the raw_window_handle() method from winit rust crate?
I'm trying to create my first Vulkan application using Rust following adrien ben's vulkan-tutorial.
As I progressed to commit 1.2.1 I noticed he is creating the winit-window for Windows.
Because I'm developing the application on my Linux-system I…

wyxvi
- 23
- 4
1
vote
1 answer
How to render a custom color under title bar with WGPU on Winit for MacOs
I am creating a rust app which uses winit and wgpu. I set the options
.with_titlebar_transparent(true)
when creating the winit window but I am not sure how to place a color under it. My goal is to make the background color of the content and the…

BigWinnz101
- 61
- 1
- 5
1
vote
0 answers
I'm unable to run rust winit application on Alpine (Wayland)
I'm following this tutorial to create a winit window with Rust on Alpine Linux.
When I started the demo application described in the tutorial using cargo run it not compile. But after installing build-base cmake musl-dev libpng-dev freetype-dev…

maurict
- 11
- 3
1
vote
1 answer
How to access scroll wheel delta in winit Event?
I am currently learning Rust by writing a small graphical program that uses winit for window handling. My goal is to implement a zoom functionality using the scroll wheel as input.
My problem is that I do not know how to access the "delta" or how…

lobis
- 145
- 1
- 10
1
vote
1 answer
How to make transparent window in rust using winit + wgpu?
I wanted to create something like rainmeter gadgets for windows. I need to create a partially-transparent window without header and borders.
Some parts of my code:
// winit
let event_loop = EventLoop::new();
let main_window = WindowBuilder::new()
…

Ciyox
- 11
- 1
0
votes
1 answer
How do I make a continuous animation loop with wasm +winit?
I have the following rust code which work when I create a native window:
event_loop.run(move |event, _, control_flow| {
control_flow.set_poll();
match event {
Event::WindowEvent {
event:…

Pap113
- 37
- 1
- 7
0
votes
1 answer
How to detect keystrokes and mouse movements using winit?
I am writing a program in Rust where I want to be able to get keystrokes and mouse movements and use them to control a camera (WASD and Mouse). How would I use winit to get these? I've been banging my head agains a wall for about an hour, and this…

Question Asker
- 5
- 3
0
votes
1 answer
Rust winit eventloop running too often
I have a simple winit application that is creating an empty window and running the EventLoop:
event_loop.run(move |event, _, control_flow| {
control_flow.set_wait_until(std::time::Instant::now() + Duration::from_millis(1000));
match event {
…

Redirectk
- 160
- 9
0
votes
2 answers
How can I make a click-through overlay in Rust that still captures input?
I already have code that creates a transparent window and draws a square on it using winit and pixels, but I can't make it click-through, that is, let the user interact with what is behind the overlay window, while still letting the app capture…

Felipe
- 23
- 5
0
votes
0 answers
Single threaded asynchronous event loop with `winit`
I'm trying to build an NES emulator using winit, which entails building a game loop which should run exactly 60 times per second.
At first, I used std::thread to create a separate thread where the game loop would run and wait 16 milliseconds before…

Eduardo Porto
- 47
- 3
0
votes
1 answer
How to use webrender to render HTML?
I recently started a project for an experimental web browser built in Rust, but I didn't want to build the renderer, so I wanted to use webrender.
I wanted to ask if anybody can explain to me how to use webrender to render an HTML document and how…

dj_tech
- 13
- 1
0
votes
1 answer
Declared function return does not match the type of the value that is returned (and inferred by the compiler)
I'm trying to get started with [imgui ] for Rust (along with [glutin] and [winit]), and I'm working on creating the event loop ([glutin]). To do this, I'm calling event_loop.run_return() (not run() since I want it to return control once the UI is…

Anon
- 13
- 1