-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
[Basic feature request] Render presses for a longer time #425
Comments
You could use the browser source. https://github.com/univrsal/input-overlay/tree/master/data/overlay_render contains an example for rendering the gamepad preset in the browser source. It cold be adapted to load any other gamepad preset and to extend button presses. |
Thank you so much for the suggestion. I have coding experience but am not familiar with javascript, so my apologies if I am a bit slow. I found a draw function in here in |
Yeah basically just keep track of whether the button was pressed before and if it isn't any more delay the switch from |
Hi again! I never got around to trying this out until recently. I am able to run the "normal" rendering example just fine. But when I try adding the delay, I encounter an issue. I modified the class keyboard_button extends button {
on_keyboard_input(vc, state) {
if (vc === this.data.code) {
if (!state){
setTimeout(function(){this.pressed = state}, 1000);
}
else {
this.pressed = state;
}
}
}
} I expected that |
Ok, the issue was related to class object references in JavaScript (sorry, again I'm still new to the language). I fixed it by creating a temporary variable: var self = this;
if (!state) {
setTimeout(function(){self.pressed = state}, 50);
} Now it runs as expected in Chrome -- great! However, I am not able to get it working in OBS right now. I can run the |
It gets a bit more tricky there, you have to handle the input data in the // Keyboard event
if (data.event_type === "key_pressed" || data.event_type === "key_released") {
if (cfg !== null)
cfg.elements.forEach(element => element.on_keyboard_input(data.keycode, data.event_type === "key_pressed"));
} |
Thank you very much for creating and maintaining this very useful plugin. In my case, I am using it to visualize hits on a drum controller (each hit maps to a keyboard press). The issue is that the keys/hits only stay pressed for a very short amount of time, so the visuals ultimately do not look very smooth. I am wondering whether it would be easy/trivial to add an option for extending the render of the "pressed" icon. For example, the key could display the "pressed" state for an additional second after it is released.
If this is too much effort to implement, I totally understand. And if it's not done through the plugin, does anyone have tips for how it could be accomplished in OBS? Is there perhaps another plugin I could use in tandem with this one?
The text was updated successfully, but these errors were encountered: