You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bellow is part of the code I use in my project, when Running natively there are no issues with ghost/repeated inputs.
When Running the same logic on wasm, If the user were to lose focus of the application while an input is still being given, that input would be continously fired for every tick/frame until the same key is pressed again.
This happens for me when A key that loads a second page in another tab is pressed and as there is no control for the focus of a new tab, it will always focus the new tab and cause the repetition of the key that was pressed.
letmut input = INPUT.lock();//let bindings = state.ecs.read_resource::<Vec<ActionBinding>>();//for btn in input.mouse_button_pressed_set().iter() {// #[cfg(debug_assertions)]// console::log(format!("Mouse Button {} is pressed", btn));//}// a vec which will store all the keys that the user has inputted on the current tickletmut inputted_keys:Vec<String> = Vec::new();// itterate of over each of the keys pressedfor key in input.key_pressed_set().iter(){// store the key as a string value for readability in saves/configlet key_string = format!("{:?}", key);
console::log(format!("key presed {}", key_string));
inputted_keys.push(key_string);}#[cfg(debug_assertions)]if inputted_keys.len() > 0{
console::log(inputted_keys.join(", "));}
The text was updated successfully, but these errors were encountered:
Bellow is part of the code I use in my project, when Running natively there are no issues with ghost/repeated inputs.
When Running the same logic on wasm, If the user were to lose focus of the application while an input is still being given, that input would be continously fired for every tick/frame until the same key is pressed again.
This happens for me when A key that loads a second page in another tab is pressed and as there is no control for the focus of a new tab, it will always focus the new tab and cause the repetition of the key that was pressed.
The text was updated successfully, but these errors were encountered: