> home > Custom Layer Boundary API

view_current_context_hook_memory

September 8th 2024
Get the memory allocated for a specific hook tied to the current details context of a view

Signature

C++
String_Const_u8
view_current_context_hook_memory(Application_Links* app,
                                 View_ID view_id,
                                 Hook_ID hook_id);

Parameters

app

the standard custom layer context pointer

view_id

the id of the view to query

hook_id

the id of the hook to query

Return

the data struct pointing to the memory set aside for the context on success, when the view and hook exit and have associated memory for the hook, otherwise cleared to zero

Details

Some hooks controlled by the view context details stack have their own requirements for unique, stable, context memory, which needs a variable sized allocation. The size of the memory available to such hooks is determined by the context details, and each instance of the context on the stack gets it's own allocation for these hooks. For example, smooth scrolling rules often require some state that wants to be locally tied to the scrolling for a particular UI loop.