HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.22k stars 340 forks source link

add window move callback #1202

Closed nspitko closed 7 months ago

nspitko commented 8 months ago

Heaps has several ways of doing window callbacks implemented, so I'm open to changing this call pattern; in this case we're using the same system as onClose (a dynamic function) but there's no need for a retval and we can't block the result so the calling pattern is simplified significantly.

The motivation for this feature is to allow multi-window apps to manage report their positions back to an underlying manager (in our case ImGui). This allows eg multi-window viewports to function.

ncannasse commented 7 months ago

There's no need to check != null when it's a dynamic function ;)

nspitko commented 7 months ago

You can null out a dynamic function, which might be how a user expects to "disable" their callback. The null check is basically free so it seemed fine to add as a safeguard, but I can remove it if you prefer.