22#include <unordered_set>
23#include <unordered_map>
81 bool tsPropertyDirty);
118 return index < pickResults_.size() ? pickResults_[index].id() :
INVALID_ENTITY.id();
135 const std::unordered_set<u32>&
screenDomain()
const {
return screen_domain_; }
139 const std::vector<u32>&
screenRoots()
const {
return screen_roots_; }
146 return index < screen_root_by_index_.size() ? screen_root_by_index_[index] : 0;
151 return lastRegistryId_ == registry.
instanceId()
153 && screen_domain_.count(entity) != 0;
157 struct InheritedState {
160 bool blocked =
false;
162 struct InheritedMemo {
164 bool resolving =
false;
165 InheritedState state;
167 std::unordered_map<Entity, InheritedMemo> inherited_cache_;
168 std::vector<Entity> inherited_path_;
169 u64 inherited_stamp_ = 0;
170 void propagateDetachedUIState(Registry& registry);
172 void hitWorldContent(Registry& registry,
const PickRay& ray,
173 const resource::ResourceManager* resources);
175 std::vector<Entity> pickResults_;
177 u64 hit_registry_{0};
178 u32 hit_activity_{0};
188 f32 lastBoxW_{0}, lastBoxH_{0}, lastBoxCX_{0}, lastBoxCY_{0};
189 bool lastAnimActive_{
false};
190 bool layoutPrimed_{
false};
193 u64 lastRegistryId_{0};
195 std::unordered_set<u32> screen_domain_;
196 std::vector<u32> screen_roots_;
198 std::vector<u32> screen_root_by_index_;
Entity utilities for the ECS system.
Central ECS registry for entity and component management.
Core type definitions and utilities for ESEngine.
Pure geometric helpers used by UISystem hit-test.
Central container for all entities and components.
bool valid(Entity entity) const
Checks if an entity is currently valid.
u64 instanceId() const
Which registry this is — unique for the process, never reused.
bool hitInputsChanged(Registry ®istry, const resource::ResourceManager *resources)
u32 pick(Registry ®istry, f32 worldX, f32 worldY)
Editor pick: the most specific UI entity under the point. Unlike hitTestUpdate it ignores Interactabl...
UISystem & operator=(const UISystem &)=delete
const std::vector< u32 > & screenRoots() const
The screen's root Canvases, in the order the UI tree draws them (each Canvas in its pool's order,...
const std::vector< u32 > & screenRootByIndex() const
screenRootOf for every entity at once, by entity index, for a reader that asks of many.
bool layoutUpdate(Registry ®istry, f32 boxLeft, f32 boxBottom, f32 boxRight, f32 boxTop, bool tsPropertyDirty)
Rebuild layout tree and apply layout to all dirty nodes. The four bounds are the world-space box UI i...
u32 screenRootOf(u32 entity) const
Which screen root entity (an id in screenDomain()) draws under; for one outside the domain,...
bool isScreenDomain(const Registry ®istry, u32 entity) const
UIHitTestResult hitResult
u32 getHitEntity() const
Entity hit by the most recent hitTestUpdate (or INVALID_ENTITY).
UISystem(const UISystem &)=delete
std::unique_ptr< LayoutCache > layoutCache_
u32 pickAll(Registry ®istry, f32 worldX, f32 worldY)
All UI entities under the point, most specific first. Returns the count; read entries via pickResult.
void hitTestUpdate(Registry ®istry, const PickRay &ray, const resource::ResourceManager *resources=nullptr)
Run ray-vs-content hit-test, updating hitResult. A query: what a press or a hover MEANS is the intera...
const std::unordered_set< u32 > & screenDomain() const
Every entity that belongs to the SCREEN, as opposed to the world.
u32 getPrevHitEntity() const
Entity hit by the previous frame's hitTestUpdate.
u32 pickResult(u32 index) const
Entry index of the last pickAll (or INVALID_ENTITY).
Central manager for GPU resources.
std::uint64_t u64
Unsigned 64-bit integer.
constexpr Entity INVALID_ENTITY
Invalid entity sentinel value.
std::uint32_t u32
Unsigned 32-bit integer.
float f32
32-bit floating point
Entity identifier with packed index + generation.
static constexpr Entity fromRaw(u32 v)
Reconstructs an Entity from a raw packed value.
constexpr u32 index() const
Gets the entity index.
Result of the most recent hit-test pass.