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
We have the buttons mapping in the initial KAPLAY options when you call kaplay(). These currently support keyboard/mouse and gamepad, however there is no support for piping clicks of on-screen areas to the simulated input buttons, you have to attach an onClick handler and do it yourself.
Could it be possible to add a button() component that depends on area(), that when it is clicked, it dispatches the specified onButtonDown etc. event handlers?
Example usage:
kaplay({buttons: {jump: {keyboard: ["space"],gamepad: ["south"]}}});add([// You can click this to jumpfixed(),pos(),rect(200,100),color(RED),area(),anchor("botright"),button("jump"),{update(){this.pos=vec2(width()-20,height()-20);}])onButtonPress("jump",()=>{debug.log("Boing!");});
The text was updated successfully, but these errors were encountered:
We have the
buttons
mapping in the initial KAPLAY options when you callkaplay()
. These currently support keyboard/mouse and gamepad, however there is no support for piping clicks of on-screen areas to the simulated input buttons, you have to attach an onClick handler and do it yourself.Could it be possible to add a
button()
component that depends onarea()
, that when it is clicked, it dispatches the specifiedonButtonDown
etc. event handlers?Example usage:
The text was updated successfully, but these errors were encountered: