Added ImGuiStorage::GetVoidPtrRef()

This commit is contained in:
ocornut
2015-04-21 10:12:17 +01:00
parent 9119f58ce5
commit c93a562b06
2 changed files with 9 additions and 0 deletions

View File

@ -1415,6 +1415,14 @@ float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val)
return &it->val_f;
}
void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val)
{
ImVector<Pair>::iterator it = LowerBound(Data, key);
if (it == Data.end() || it->key != key)
it = Data.insert(it, Pair(key, default_val));
return &it->val_p;
}
// FIXME-OPT: Wasting CPU because all SetInt() are preceeded by GetInt() calls so we should have the result from lower_bound already in place.
// However we only use SetInt() on explicit user action (so that's maximum once a frame) so the optimisation isn't much needed.
void ImGuiStorage::SetInt(ImU32 key, int val)