|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
|
nodiscard |
Register a callback to be invoked whenever path is reloaded.
The callback fires during update() after the hot-reload interval elapses and the loader reports a new revision for path. The watch is automatically cancelled when the returned WatchHandle is destroyed.
A change is delivered at most once per HOT_RELOAD_INTERVAL and only after the revision has been stable for PENDING_RELOAD_INTERVAL, so a callback can lag the file write by roughly 400 ms.
Exceptions thrown from the callback are caught and logged; the change is treated as delivered and will not be retried until the asset changes again. Callbacks run after the watch map has been scanned, so calling watch() or destroying a WatchHandle from inside one is safe.
| path | Asset path to monitor. |
| callback | Function called with path when the asset changes. |