adding multiple hooks supports for events and loop

This commit is contained in:
2024-12-17 02:33:04 +01:00
parent 30f4602b1c
commit 62bd63c364
15 changed files with 77 additions and 59 deletions

View File

@@ -12,9 +12,13 @@ namespace mlx
{
if(!m_windows.contains(window_id))
return;
if(!m_events_hooks.contains(window_id) || !m_events_hooks[window_id][event].hook)
if(!m_events_hooks.contains(window_id) || m_events_hooks[window_id][event].empty())
return;
m_events_hooks[window_id][event].hook(code, m_events_hooks[window_id][event].param);
for(const auto& hook : m_events_hooks[window_id][event])
{
if(hook.fn)
hook.fn(code, hook.param);
}
});
}