Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::UiTextureId Class Reference

Opaque identifier for a UI texture registration, in the form ImGui carries through draw data. More...

#include "donner/editor/gui/UiTextureRegistry.h"

Public Member Functions

 UiTextureId ()=default
 Constructs a null identifier.
bool isValid () const
 Returns true if this identifier is non-null. A non-null identifier may still be stale; only UiTextureRegistry::lookup is authoritative.
uint32_t slotIndex () const
 Registry slot index this identifier names.
uint32_t generation () const
 Registry slot generation at registration time. Zero for null identifiers.
ImTextureID imTextureId () const
 Returns the value to hand ImGui, which returns it unchanged in ImDrawCmd. Zero for null identifiers.
bool operator== (const UiTextureId &other) const =default
 Equality operator.

Static Public Member Functions

static UiTextureId FromImTextureId (ImTextureID value)
 Reconstructs an identifier from a value ImGui carried through draw data.
static UiTextureId CreateForRegistry (uint32_t slotIndex, uint32_t generation)
 Mints an identifier for a registry slot; called by UiTextureRegistry only.

Detailed Description

Opaque identifier for a UI texture registration, in the form ImGui carries through draw data.

The value is a registry slot plus the generation that slot held when the registration was made. It is deliberately not a backend object address: a value reaching the registry from recorded draw data is untrusted, and a slot/generation pair lets a recycled slot reject a token minted for the registration that used to live there. Slot generations start at one, so every valid identifier is nonzero and zero keeps ImGui's "no texture" meaning.

Member Function Documentation

◆ CreateForRegistry()

UiTextureId donner::editor::UiTextureId::CreateForRegistry ( uint32_t slotIndex,
uint32_t generation )
inlinestatic

Mints an identifier for a registry slot; called by UiTextureRegistry only.

Parameters
slotIndexRegistry slot index.
generationSlot generation at registration time; must be nonzero.

◆ FromImTextureId()

UiTextureId donner::editor::UiTextureId::FromImTextureId ( ImTextureID value)
inlinestatic

Reconstructs an identifier from a value ImGui carried through draw data.

The value is not trusted: the resulting identifier is only meaningful once UiTextureRegistry::lookup accepts it.

Parameters
valueValue previously returned by imTextureId.

◆ operator==()

bool donner::editor::UiTextureId::operator== ( const UiTextureId & other) const
default

Equality operator.

Parameters
otherIdentifier to compare against.

The documentation for this class was generated from the following file: