kaplay icon indicating copy to clipboard operation
kaplay copied to clipboard

feat: Include input events to `obj.clearEvents()`

Open amyspark-ng opened this issue 9 months ago • 3 comments

Is your feature request related to a problem? Please describe.

If you do something like

obj.onMousePress("left", () => {
    debug.log("hello")
})

obj.clearEvents()

The onMousePress will still work despite onMousePress "being cleared" from the object, this clearEvents only works onUpdate and onDraw afaik

The event DOES get cleared when the object is destroyed i think, so i don't know why it happens this way

amyspark-ng avatar Mar 02 '25 23:03 amyspark-ng

I works on all event except for input events. This is because input events are actually global and objects only hold a reference to the event, not the actual event.

mflerackers avatar Mar 03 '25 00:03 mflerackers

Is there a reason why this is done this way?

amyspark-ng avatar Mar 03 '25 01:03 amyspark-ng

Only tga knows, and tga didn't wrote comments why.

mflerackers avatar Mar 03 '25 01:03 mflerackers