Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

2.0 KB
Raw Blame
// Auto-generated by EHT (aot_components) — DO NOT EDIT.
// The type half of the AOT contract: a manifest names a component, and a
// compiled system needs the bytes. Regenerate with `pnpm eht`.
#pragma once

#include "esengine/aot/AotHost.hpp"

namespace esengine::ecs { class Registry; }

namespace esengine::aot {

/**
 * Where a named ENGINE component lives, for this registry.
 *
 * `tryGet`, never `getOrEmplace`: a resolver that created the component
 * would give one to every entity the query walked, and a row is kept only
 * when every component resolves — the absence IS the filter.
 *
 * No lazily-derived field is refreshed, because the interpreted side does
 * not refresh one either and it is the oracle. A component whose fields are
 * stale until a method runs cannot be read by a compiled system at all, and
 * that is a subset question rather than a resolver one.
 *
 * An unknown name yields an EMPTY resolver: a project component lives in the
 * script pool and is not this table's to answer for. Call it and it throws,
 * so a caller must ask `isEngineComponent` first.
 */
ComponentAt engineComponentAt(ecs::Registry& registry, const char* name);

/**
 * WHO has that component, for a caller narrowing a query to its shortest
 * column.
 *
 * The resolver above answers per entity and can only be asked about one
 * that is already a candidate; this is where candidates come FROM. A host
 * without it must offer every entity, and then what a compiled system
 * costs is the size of the world instead of the size of what it matches.
 *
 * An empty span means nobody has it — a query that matches nothing. The
 * empty FUNCTION means this table does not answer for the name, which is
 * a different answer and the caller must not narrow on it.
 */
CandidatesOf engineComponentCandidates(ecs::Registry& registry, const char* name);

/** Whether this table answers for that name, without building a resolver. */
bool isEngineComponent(const char* name);

}  // namespace esengine::aot